Merge "Convert Special:DeletedContributions to use OOUI."
[lhc/web/wiklou.git] / includes / page / ImageHistoryPseudoPager.php
index e421d23..f4880d1 100644 (file)
@@ -40,8 +40,12 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                $this->mTitle = clone $imagePage->getTitle();
                $this->mTitle->setFragment( '#filehistory' );
                $this->mImg = null;
-               $this->mHist = array();
-               $this->mRange = array( 0, 0 ); // display range
+               $this->mHist = [];
+               $this->mRange = [ 0, 0 ]; // display range
+
+               // Only display 10 revisions at once by default, otherwise the list is overwhelming
+               $this->mLimitsShown = array_merge( [ 10 ], $this->mLimitsShown );
+               $this->setLimit( 10 );
        }
 
        /**
@@ -111,7 +115,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                if ( $this->mQueryDone ) {
                        return;
                }
-               $this->mImg = $this->mImagePage->getFile(); // ensure loading
+               $this->mImg = $this->mImagePage->getPage()->getFile(); // ensure loading
                if ( !$this->mImg->exists() ) {
                        return;
                }
@@ -122,7 +126,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                        // The current rev may not meet the offset/limit
                        $numRows = count( $this->mHist );
                        if ( $numRows <= $this->mLimit && $this->mImg->getTimestamp() > $this->mOffset ) {
-                               $this->mHist = array_merge( array( $this->mImg ), $this->mHist );
+                               $this->mHist = array_merge( [ $this->mImg ], $this->mHist );
                        }
                } else {
                        // The current rev may not meet the offset
@@ -148,14 +152,14 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                                        # Index value of bottom item in the list
                                        $lastIndex = $this->mHist[1]->getTimestamp();
                                        # Display range
-                                       $this->mRange = array( 1, $numRows - 1 );
+                                       $this->mRange = [ 1, $numRows - 1 ];
                                } else {
                                        # Index value of item past the index
                                        $this->mPastTheEndIndex = $this->mHist[$numRows - 1]->getTimestamp();
                                        # Index value of bottom item in the list
                                        $lastIndex = $this->mHist[$numRows - 2]->getTimestamp();
                                        # Display range
-                                       $this->mRange = array( 0, $numRows - 2 );
+                                       $this->mRange = [ 0, $numRows - 2 ];
                                }
                        } else {
                                # Setting indexes to an empty string means that they will be
@@ -167,7 +171,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                                $lastIndex = $this->mIsBackwards ?
                                        $this->mHist[0]->getTimestamp() : $this->mHist[$numRows - 1]->getTimestamp();
                                # Display range
-                               $this->mRange = array( 0, $numRows - 1 );
+                               $this->mRange = [ 0, $numRows - 1 ];
                        }
                } else {
                        $firstIndex = '';