Log Entries
Date & Time
IP Address
Type
Username
Info
---
Search
= 5) { // Add valid log entries to an array $log_entries[] = [ 'date' => htmlspecialchars($data[0]), 'ip' => htmlspecialchars($data[1]), 'type' => htmlspecialchars($data[2]), 'username' => htmlspecialchars($data[3]), 'info' => htmlspecialchars($data[4]) ]; } } fclose($fp); } // Reverse the log entries to display the latest first $log_entries = array_reverse($log_entries); // Filter log entries by search terms (partial matches) $filtered_entries = array_filter($log_entries, function ($entry) use ($search_ip, $search_type, $search_username, $search_info) { $ip_match = empty($search_ip) || stripos($entry['ip'], $search_ip) !== false; $type_match = empty($search_type) || stripos($entry['type'], $search_type) !== false; $username_match = empty($search_username) || stripos($entry['username'], $search_username) !== false; $info_match = empty($search_info) || stripos($entry['info'], $search_info) !== false; return $ip_match && $type_match && $username_match && $info_match; }); // Calculate total pages and slice the log entries for the current page $total_entries = count($filtered_entries); $total_pages = ceil($total_entries / $items_per_page); $paged_entries = array_slice($filtered_entries, $offset, $items_per_page); // Display the filtered entries for the current page foreach ($paged_entries as $entry) { echo "
{$entry['date']}
{$entry['ip']}
{$entry['type']}
{$entry['username']}
{$entry['info']}
"; } if (empty($paged_entries)) { echo "
No log entries found.
"; } ?>
1): ?>
Previous
= $page ?>
Next