// Page filters
$this->addTables( 'page' );
- if ( !$this->addWhereIf( 'page_is_redirect = 1', $params['filterredir'] === 'redirects' ) )
- $this->addWhereIf( 'page_is_redirect = 0', $params['filterredir'] === 'nonredirects' );
+
+ if ( $this->params['filterredir'] == 'redirects' )
+ $this->addWhereFld( 'page_is_redirect', 1 );
+ else if ( $this->params['filterredir'] == 'nonredirects' )
+ $this->addWhereFld( 'page_is_redirect', 0 );
+
$this->addWhereFld( 'page_namespace', $params['namespace'] );
$dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
$from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
$this->addWhereRange( 'page_title', $dir, $from, null );
+
if ( isset ( $params['prefix'] ) )
$this->addWhere( 'page_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
$this->addWhereFld( 'page_namespace', $this->params['namespace'] );
if ( !is_null( $this->contID ) )
$this->addWhere( "{$this->bl_from}>={$this->contID}" );
+
if ( $this->params['filterredir'] == 'redirects' )
$this->addWhereFld( 'page_is_redirect', 1 );
else if ( $this->params['filterredir'] == 'nonredirects' )
$this->addWhereFld( 'page_is_redirect', 0 );
+
$this->addOption( 'LIMIT', $this->params['limit'] + 1 );
$this->addOption( 'ORDER BY', $this->bl_from );
$this->addOption( 'STRAIGHT_JOIN' );