bounding for the limit parameter
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 23 Jun 2006 06:39:40 +0000 (06:39 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 23 Jun 2006 06:39:40 +0000 (06:39 +0000)
includes/PageHistory.php

index 8b72a0a..074c3ed 100644 (file)
@@ -95,6 +95,14 @@ class PageHistory {
                 * offset, the timestamp to begin at, from the URL.
                 */
                $limit = $wgRequest->getInt('limit', $this->defaultLimit);
+               if ( $limit <= 0 ) {
+                       $limit = $this->defaultLimit;
+               } elseif ( $limit > 50000 ) {
+                       # Arbitrary maximum
+                       # Any more than this and we'll probably get an out of memory error
+                       $limit = 50000;
+               }
+
                $offset = $wgRequest->getText('offset');
 
                /* Offset must be an integral. */