2000000) { $content = file_get_contents($filePath, false, null, -2000000); $fileSizeMb = filesize($filePath) / 1000000; } else { $content = file_get_contents($filePath); $fileSizeMb = filesize($filePath) / 1000000; } // Prepare the download button HTML if filePath resides under the active log base path $downloadButtonHtml = ''; $logPrefix = $logBasePath . '/'; if ($logPrefix !== '/' && strpos($filePath, $logPrefix) === 0) { $downloadName = basename($filePath); $downloadButtonHtml = ' '; } // Prepare buttons HTML $buttonsHtml = ''; $totalButtons = count($buttons); if ($totalButtons > 0) { $colClass = 12 / $totalButtons; // Use $colClass in your HTML generation or further logic } else { // Handle case where $buttons array is empty $colClass = 12; } foreach ($buttons as $button) { $labelStringCode = isset($button['labelStringCode']) ? $button['labelStringCode'] : ''; $event = isset($button['event']) ? $button['event'] : ''; $buttonsHtml .= '
'; } // Render the log area HTML $html = '