Merge "Add .pipeline/ with dev image variant"
[lhc/web/wiklou.git] / includes / page / ImageHistoryPseudoPager.php
index 20bc614..17a6d51 100644 (file)
@@ -18,6 +18,8 @@
  * @file
  */
 
+use Wikimedia\Timestamp\TimestampException;
+
 class ImageHistoryPseudoPager extends ReverseChronologicalPager {
        protected $preventClickjacking = false;
 
@@ -75,7 +77,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
        }
 
        public function getQueryInfo() {
-               return false;
+               return [];
        }
 
        /**
@@ -138,6 +140,14 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                if ( !$this->mImg->exists() ) {
                        return;
                }
+               // Make sure the date (probably from user input) is valid; if not, drop it.
+               if ( $this->mOffset !== null ) {
+                       try {
+                               $sadlyWeCannotPassThisTimestampDownTheStack = $this->mDb->timestamp( $this->mOffset );
+                       } catch ( TimestampException $e ) {
+                               $this->mOffset = null;
+                       }
+               }
                $queryLimit = $this->mLimit + 1; // limit plus extra row
                if ( $this->mIsBackwards ) {
                        // Fetch the file history