Index: branches/stable/cgi-bin/search.cgi
===================================================================
--- branches/stable/cgi-bin/search.cgi	(revision 356)
+++ branches/stable/cgi-bin/search.cgi	(revision 357)
@@ -40,4 +40,8 @@
 my %webvar = parse_post();
 cleanInput(\%webvar);
+
+if (defined($webvar{rpp})) {
+  ($RESULTS_PER_PAGE) = ($webvar{rpp} =~ /(\d+)/);
+}
 
 if (!defined($webvar{stype})) {
@@ -185,5 +189,6 @@
   } else {
     # Add the limit/offset clauses
-    $sql .= " order by cidr limit $RESULTS_PER_PAGE offset $offset";
+    $sql .= " order by cidr";
+    $sql .= " limit $RESULTS_PER_PAGE offset $offset" if $RESULTS_PER_PAGE != 0;
     # And tell the user.
     print "<div class=heading>Searching...............</div>\n";
@@ -420,5 +425,5 @@
 
   # print the page thing..
-  if ($rowCount > $RESULTS_PER_PAGE) {
+  if ($RESULTS_PER_PAGE > 0 && $rowCount > $RESULTS_PER_PAGE) {
     my $pages = ceil($rowCount/$RESULTS_PER_PAGE);
     print qq(<div class="center"> Page: );
