ghwikipp: search: Fixed output (bug in regexp, use htmlspecialchars).

From d55d5f3f2642f6926953956be072afa7788e3e27 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 24 Sep 2026 15:20:21 +0000
Subject: [PATCH] search: Fixed output (bug in regexp, use htmlspecialchars).

Fixes #68.
---
 index.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.php b/index.php
index 80b92c6..a31f256 100644
--- a/index.php
+++ b/index.php
@@ -1498,7 +1498,7 @@ function sort_search_results($a, $b)
 
         $pagehits = array();
         foreach ($output as $l) {
-            if (preg_match("/^.*\/$raw_data\/(.*)\..*?\:(.*)$/", $l, $matches) != 1) { continue; }
+            if (preg_match("/^.*\/$raw_data\/(.*?)\..*?\:(.*)$/", $l, $matches) != 1) { continue; }
             $p = $matches[1];
             $txt = $matches[2];
 
@@ -1528,7 +1528,7 @@ function sort_search_results($a, $b)
                 $htmllist .= "<li><a href='/$p'>$p</a>:<dl>\n";
                 $first = true;
                 foreach ($txt as $t) {
-                    $htmltxt = $t; //htmlspecialchars($t, ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED|ENT_HTML5, 'UTF-8');
+                    $htmltxt = htmlspecialchars($t, ENT_QUOTES|ENT_SUBSTITUTE|ENT_DISALLOWED|ENT_HTML5, 'UTF-8');
                     if ($first) {
                         $first = false;
                     } else {