+ $this->addWhereFld( 'page_namespace', $params['namespace'] );
+ if ( $params['redirect'] || $params['filterredir'] === 'redirects' ) {
+ $this->addWhereFld( 'page_is_redirect', 1 );
+ } elseif ( $params['filterredir'] === 'nonredirects' ) {
+ $this->addWhereFld( 'page_is_redirect', 0 );
+ } elseif ( is_null( $resultPageSet ) ) {
+ $this->addFields( array( 'page_is_redirect' ) );
+ }
+ $this->addOption( 'LIMIT', $limit + 1 );
+
+ if ( $start !== null ) {
+ $start = $this->getDB()->addQuotes( $start );
+ if ( $startId !== null ) {
+ $startId = (int)$startId;
+ $this->addWhere( "page_random = $start AND page_id >= $startId OR page_random > $start" );
+ } else {
+ $this->addWhere( "page_random >= $start" );
+ }
+ }
+ if ( $end !== null ) {
+ $this->addWhere( 'page_random < ' . $this->getDB()->addQuotes( $end ) );
+ }
+ $this->addOption( 'ORDER BY', array( 'page_random', 'page_id' ) );
+
+ $result = $this->getResult();
+ $path = array( 'query', $this->getModuleName() );