From c43dc93ed1891f4140869ae4c34a3ec0c2f3c644 Mon Sep 17 00:00:00 2001 From: Georg Sieber Date: Mon, 1 Dec 2025 21:22:13 +0100 Subject: [PATCH] get correct URL for all cases --- MatomoTracker.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/MatomoTracker.php b/MatomoTracker.php index 0e4f41b..86ef1ca 100644 --- a/MatomoTracker.php +++ b/MatomoTracker.php @@ -2324,16 +2324,14 @@ protected function getCookieMatchingName(string $name) protected static function getCurrentScriptName(): string { $url = ''; - if (!empty($_SERVER['PATH_INFO'])) { - $url = $_SERVER['PATH_INFO']; - } else { - if (!empty($_SERVER['REQUEST_URI'])) { - if (($pos = strpos($_SERVER['REQUEST_URI'], '?')) !== false) { - $url = substr($_SERVER['REQUEST_URI'], 0, $pos); - } else { - $url = $_SERVER['REQUEST_URI']; - } + if (!empty($_SERVER['REQUEST_URI'])) { + if (($pos = strpos($_SERVER['REQUEST_URI'], '?')) !== false) { + $url = substr($_SERVER['REQUEST_URI'], 0, $pos); + } else { + $url = $_SERVER['REQUEST_URI']; } + } elseif (!empty($_SERVER['PATH_INFO'])) { + $url = $_SERVER['PATH_INFO']; } if (empty($url) && isset($_SERVER['SCRIPT_NAME'])) { $url = $_SERVER['SCRIPT_NAME'];