console.log(" . json_encode($log_msg) . ");"; $all_results = $_SESSION["search_results"] ?? []; $query = $_SESSION["search_query"] ?? ""; $totalResultsCount = count($all_results); $limit = isset($_GET['limit']) ? (int)$_GET['limit'] : 10; if (!in_array($limit, [10, 20, 50, 100])) { $limit = 10; } // Gesamtseitenzahl $totalPages = max(1, ceil($totalResultsCount / $limit)); // Aktuelle Seite auslesen und validieren $currentPage = isset($_GET['page']) ? (int)$_GET['page'] : 1; if ($currentPage < 1) { $currentPage = 1; } elseif ($currentPage > $totalPages) { $currentPage = $totalPages; } // Startpunkt im Array berechnen (Offset) $offset = ($currentPage - 1) * $limit; // Nur die Ergebnisse für die aktuelle Seite ausschneiden //$results = array_slice($all_results, $offset, $limit); $results = $all_results; $resultCount = count($results); ?>