From afc839bee133928bce96386928d03be3b7829a84 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Tue, 22 Oct 2024 09:29:46 +0200 Subject: [PATCH] improve search result display --- index.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 202f045..913a2ea 100644 --- a/index.php +++ b/index.php @@ -58,9 +58,9 @@
new download +
-
@@ -94,7 +94,12 @@ if ($filter && str_contains(cleanstring($content), cleanstring($filter))) { $pos = strpos(cleanstring($content), cleanstring($filter)); - echo ' ' . $filter . substr($content, $pos + strlen($filter), 42) . ''; + $start = max($pos - 21, 0); + echo ' '; + echo substr($content, $start, min(21, $pos)); + echo '' . $filter . ''; + echo substr($content, $pos + strlen($filter), 21); + echo ''; } echo''; }