diff --git a/root/opt/mailstats/html/showSummaryLogs.php b/root/opt/mailstats/html/showSummaryLogs.php index 9f2535e..a0bf120 100644 --- a/root/opt/mailstats/html/showSummaryLogs.php +++ b/root/opt/mailstats/html/showSummaryLogs.php @@ -38,13 +38,45 @@ function generateLogDataTable($logData) { return "Invalid JSON data"; } - $keys = array_keys($data); - $values = array_values($data); + //// Remove entries with the key "logterse" + //if (isset($data['logterse'])) { + //unset($data['logterse']); + //} + + // Remove entries with the key "logterse" and remove entries with empty values + foreach ($data as $key => $value) { + if ($key === 'logterse' || empty($value)) { + unset($data[$key]); + } + } + + // Handle adjacent duplicates by merging keys + $mergedData = []; + $previousValue = null; + foreach ($data as $key => $value) { + if ($value === $previousValue) { + // Merge the current key with the previous key + end($mergedData); + $lastKey = key($mergedData); + $newKey = "$lastKey/$key"; + $mergedData[$newKey] = $value; + // Remove the old entry + unset($mergedData[$lastKey]); + } else { + // Otherwise, add a new entry + $mergedData[$key] = $value; + } + $previousValue = $value; + } + + + $keys = array_keys($mergedData); + $values = array_values($mergedData); - $output = ''; + $output = '
'; // Divide keys and values into sets of 6 - $chunks = array_chunk($keys, 7); + $chunks = array_chunk($keys, 6); foreach ($chunks as $chunkIndex => $chunk) { if ($chunkIndex > 0) { // Add spacing between different sets @@ -57,7 +89,7 @@ function generateLogDataTable($logData) { } $output .= ''; foreach ($chunk as $i => $key) { - $output .= ''; + $output .= ''; } $output .= ''; } @@ -72,24 +104,27 @@ function generateLogDataTable($logData) { + Summary Logs - +--> +
"

Summary Logs for Date:

-
' . htmlspecialchars($values[$chunkIndex * 7 + $i]) . '' . htmlspecialchars($values[$chunkIndex * 6+ $i]) . '
+
@@ -113,6 +148,7 @@ function generateLogDataTable($logData) {
Id
+ close();