weird search results being recorded
<p>i noticed some weird search results being recorded like this:</p>
<p><img src="https://i.imgur.com/012elP0.png" /></p>
<p>the search function should only be recording a result if it finds a result, so this should not be added unless it can actually find this text, which i doubt it. </p>
<p>Some annoying robot is adding this i think. </p>
<p>page: search.page.php</p>
<h4>PHP</h4>
<pre><code class="php hljs">if($searchvalue > "") {<br /> $pagecontent .= $class->listall(<br /> $start = $startval,<br /> $max = $pagestep,<br /> "search", <br /> $templatefilename,<br /> $searchterm = $searchvalue<br /> );<br />}</code></pre>
<p>i think the issue is with the search link text being added from the url. it does not validate if the text exists on the page before adding it, so need a check on there before adding it. </p>
<p>e.g: <a href="https://kruxor.com/view/code/DPkzR/weird-search-results-being-recorded/searchtext:::weird%20search%20results%20being%20recorded">https://kruxor.com/view/code/DPkzR/weird-search-results-being-recorded/searchtext:::weird%20search%20results%20being%20recorded</a> </p>
<p>I have only allowed the characters on searches, so this should fix the random text issues now.</p>
<h4>PHP</h4>
<pre><code class="php hljs">$searchtext = pregreplace("/[^A-Za-z0-9 ]/", '', $searchtext);</code></pre>
<p>see if this solves the problem</p>