diff --git a/js/customElements/newComment.js b/js/customElements/newComment.js
index 9c01967c4964ed0adb5e43e6fb4179aecda9b48e..0080b3eb98abbfb4abbfbe964096f53b7c29b647 100644
--- a/js/customElements/newComment.js
+++ b/js/customElements/newComment.js
@@ -14,6 +14,7 @@ class newComment extends HTMLElement {
         script.src = "https://hCaptcha.com/1/api.js";
         script.type = 'text/javascript';
         script.onload = () => {
+            let pageName = path.split("/").pop();
             this.parentElement.innerHTML = ` 
                 <form action="/API/newComment.php" method="post">
                     <label for="name">Name:</label><br>
@@ -27,6 +28,7 @@ class newComment extends HTMLElement {
                     
                     <div class="h-captcha" data-theme="dark" data-sitekey="${sitekey}"></div><br>
                     
+                    <input type="hidden" name="pagename" id="pagename" value="${pageName}">
                     <input type="submit" value="Kommentar ver&ouml;ffentlichen"><br>
                     <p>Mit dem Klick auf den obigen Button erkl&auml;ren sie sich mit der <a href="/datenschutzerklaerung.html">Datenschutzerkl&auml;rung</a> einverstanden.</p>
                 </form>
@@ -36,4 +38,4 @@ class newComment extends HTMLElement {
     }
 }
 
-customElements.define("jl-new_comment", newComment);
\ No newline at end of file
+customElements.define("jl-new_comment", newComment);
diff --git a/public/API/newComment.php b/public/API/newComment.php
index c9e293e9a8e3f391dfee2aff286e5df16cd3f175..1d63270193b2a0e7e4c15e0fba5d8d3a274805d6 100644
--- a/public/API/newComment.php
+++ b/public/API/newComment.php
@@ -22,8 +22,7 @@ $responseData = json_decode($response->getBody());
 
 if($responseData->success) {
 
-    $ref = $_SERVER["HTTP_REFERER"];
-    $article = $conn->escape_string(explode(".php", explode("Projekte/", $ref)[1])[0]);
+    $article =$conn->escape_string($_POST["pagename"]);
     $name = $conn->escape_string($_POST["name"]);
     $email = $conn->escape_string($_POST["email"]);
     $comment = $conn->escape_string($_POST["comment"]);
@@ -37,4 +36,4 @@ if($responseData->success) {
     }
 } else {
     echo "Failed to verify captcha.";
-}
\ No newline at end of file
+}