prepare($countQuery); $stmt->execute($params); $totalTests = $stmt->fetchColumn(); $totalPages = ceil($totalTests / $limit); // Fetch Data $query = " SELECT t.*, g.name_$lang as group_name FROM laboratory_tests t LEFT JOIN test_groups g ON t.group_id = g.id $where ORDER BY t.id DESC LIMIT $limit OFFSET $offset"; $stmt = $db->prepare($query); $stmt->execute($params); $tests = $stmt->fetchAll(); // Fetch all groups for filter dropdown (only needed for initial load, but fast enough) $gStmt = $db->query("SELECT * FROM test_groups ORDER BY name_$lang"); $all_test_groups = $gStmt->fetchAll(); $sys_settings = get_system_settings(); $currency_symbol = $sys_settings['currency_symbol'] ?? '$'; // --- AJAX HANDLER --- if (isset($_GET['ajax_search'])) { ob_start(); if (empty($tests)): ?>
1): ?>
-
$table_html, 'pagination' => $pagination_html]); exit; } ?>

#
1): ?>
-