$file, 'date' => $date, 'path' => $logs_dir . $file, 'size' => filesize($logs_dir . $file) ]; } } } // Sort by date descending, then by filename usort($log_files, function($a, $b) { if ($a['date'] === $b['date']) { return strcmp($b['filename'], $a['filename']); } return $b['date'] <=> $a['date']; }); // Load selected log content $contents = ''; if ($selected_log && file_exists($logs_dir . $selected_log)) { $contents = file_get_contents($logs_dir . $selected_log); } elseif (!empty($log_files)) { // Default to most recent log $contents = file_get_contents($log_files[0]['path']); $selected_log = $log_files[0]['filename']; } else { $contents = 'No application log files found.'; } $filelocation_webserver = '/var/www/vhosts/morvalwatches.com/logs/'.$_SERVER['HTTP_HOST'].'/access_ssl_log'; if (file_exists($filelocation_webserver)){ $contents_webserver = file_get_contents($filelocation_webserver); } else {$contents_webserver = 'No webserver log file found.';} ?> ✓ ' . htmlspecialchars($delete_message) . ' '; } echo '

Application Log

'; ?>