$row) { if ( str_contains(strtolower((string)$row['supplier']), $lowerSearch) || str_contains(strtolower((string)$row['reference']), $lowerSearch) ) { $filteredPurchases[$key] = $row; } } } else { $filteredPurchases = $allPurchases; } // Pagination logic $page = max(1, (int)($_GET['p'] ?? 1)); $limit = 10; $total = count($filteredPurchases); $totalPages = max(1, ceil($total / $limit)); $offset = ($page - 1) * $limit; $purchaseRows = array_slice($filteredPurchases, $offset, $limit, true); require __DIR__ . '/includes/header.php'; ?>

1): ?>