Report 10 random matches as minimal typo solver.
<h2>Pagina niet gevonden</h2>
<p>De gevraagde pagina <em>[[url]]</em> bestaat niet.</p>
+
+<p>Misschien is de gewenste inhoud hier te vinden:</p>
+
+[[search]]
function __construct($path)
{
$this->page = $path;
- $this->link = preg_replace('/\.html$/', '', $path);
+ $this->link = preg_replace('{(?:/index)?\.html$}', '', $path);
}
function __get($col)
function safetitle()
{
- return strip_tags($this->title);
+ return trim(strip_tags($this->title));
+ }
+
+ function name()
+ {
+ return $this->safetitle ?: $this->link;
}
function last()
--- /dev/null
+<?php
+$path = ' '.escapeshellarg('*.html');
+$cmd = "git grep -li -- ".escapeshellarg($Page).$path;
+$cmd .= ' |sort -R |head -n 10'; # random selection
+exec($cmd, $results);
+
+if (!$results) {
+ $results = ['index.html'];
+}
+
+require_once('nieuws.inc.php');
+print '<ul>';
+foreach ($results as $result) {
+ $page = new ArchiveArticle($result);
+ printf('<li><a href="/%s">%s</a></li>'."\n", $page->link, $page->name);
+}
+print "</ul>\n";