From a3dd0b9fbd2f12ec4da9caa5faef57e426733749 Mon Sep 17 00:00:00 2001 From: dkyme Date: Mon, 14 Aug 2023 10:58:36 +0200 Subject: [PATCH] replace strlen in readPages() with variables see issue #671 --- lib/Pico.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Pico.php b/lib/Pico.php index 4c3b0abb..ae303854 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -1771,6 +1771,8 @@ protected function readPages(): void { $contentDir = $this->getConfig('content_dir'); $contentExt = $this->getConfig('content_ext'); + $contentDirLen = strlen($contentDir); + $contentExtLen = strlen($contentExt); $this->pages = []; $files = $this->getFiles($contentDir, $contentExt, self::SORT_NONE); @@ -1781,7 +1783,7 @@ protected function readPages(): void continue; } - $id = substr($file, strlen($contentDir), -strlen($contentExt)); + $id = substr($file, $contentDirLen, -$contentExtLen); // trigger onSinglePageLoading event // skip inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists) by default