diff --git a/class/FileHandler.php b/class/FileHandler.php index 7c7230c..72afd01 100644 --- a/class/FileHandler.php +++ b/class/FileHandler.php @@ -34,6 +34,18 @@ class FileHandler { return !!($this->config["log"]); } + + public function countLogs() + { + if(!$this->config["log"]) + return; + + if(!$this->outuput_folder_exists()) + return; + + $folder = dirname(__DIR__).'/'.$this->config["logFolder"].'/'; + return count(glob($folder.'*.txt', GLOB_BRACE)); + } public function listLogs() { diff --git a/views/header.php b/views/header.php index c6ab8d3..a80d232 100644 --- a/views/header.php +++ b/views/header.php @@ -35,7 +35,7 @@ // Logs if ($file->is_log_enabled()) { - $filesCount = count($file->listLogs()); + $filesCount = $file->countLogs(); if ($filesCount < 1) { echo '
  • Logs
  • '; } else {