diff --git a/modules/statistics/www/showstats.php b/modules/statistics/www/showstats.php index bf8327caa522eb64abc339b1e84b14ba8e07c90b..aa0c67b0fb00594c7ab778d68f35cdcd38211451 100644 --- a/modules/statistics/www/showstats.php +++ b/modules/statistics/www/showstats.php @@ -25,6 +25,8 @@ foreach ($filelist AS $file) { } } } +if (empty($available)) + throw new Exception('No aggregated statistics files found in [' . $statdir . ']'); /* * Create array with information about available rules.. @@ -62,7 +64,12 @@ if (array_key_exists('time', $_GET)) { } // Get file and extract results. -$resultfile = file_get_contents($statdir . $rule . '-' . $fileslot . '.stat'); +$resultFileName = $statdir . $rule . '-' . $fileslot . '.stat'; +if (!file_exists($resultFileName)) + throw new Exception('Aggregated statitics file [' . $resultFileName . '] not found.'); +if (!is_readable($resultFileName)) + throw new Exception('Could not read statitics file [' . $resultFileName . ']. Bad file permissions?'); +$resultfile = file_get_contents($resultFileName); $results = unserialize($resultfile);