private function determinePath(array $server): string
    {
        $path = '';
        if (strpos($server['SCRIPT_NAME'], 'index.php') !== false) {
            $path = str_replace('index.php', '', $server['SCRIPT_NAME']);
        }

        $parts = explode('?', $server['REQUEST_URI']);

        $length = 0;
        if ($path !== '' && strpos($parts[0], $path) === 0) {
            $length = strlen($path);
        }

        return '/' . ltrim(substr($parts[0], $length), '/');
    }