diff --git a/PicoZCache.php b/PicoZCache.php index 71e9a7d..90c5991 100644 --- a/PicoZCache.php +++ b/PicoZCache.php @@ -20,7 +20,7 @@ class PicoZCache extends AbstractPicoPlugin private $cacheXHTML = false; private $cacheFileName; - public function onConfigLoaded(array &$settings) + public function onConfigLoaded(array &$config) { if (isset($config['cache_dir'])) { @@ -45,7 +45,7 @@ public function onConfigLoaded(array &$settings) public function onRequestUrl(&$url) { //replace any character except numbers and digits with a '-' to form valid file names - $this->cacheFileName = $this->cacheDir . preg_replace('/[^A-Za-z0-9_\-]/', '_', $url) . '.html'; + $this->cacheFileName = $this->cacheDir . (empty($url) ? 'index' : preg_replace('/[^A-Za-z0-9_\-]/', '_', $url)) . '.html'; //if a cached file exists and the cacheTime is not expired, load the file and exit if ($this->doCache && file_exists($this->cacheFileName) && (time() - filemtime($this->cacheFileName)) < $this->cacheTime) {