- $this->addTables('pagelinks');
- $this->addWhereFld('pl_namespace', $params['namespace']);
-
- if (!is_null($params['from']) && !is_null($params['continue']))
- $this->dieUsage('alcontinue and alfrom cannot be used together', 'params');
- if (!is_null($params['continue']))
- {
- $arr = explode('|', $params['continue']);
- if(count($arr) != 2)
- $this->dieUsage("Invalid continue parameter", 'badcontinue');
- $from = $this->getDB()->strencode($this->titleToKey($arr[0]));
- $id = intval($arr[1]);
- $this->addWhere("pl_title > '$from' OR " .
- "(pl_title = '$from' AND " .
- "pl_from > $id)");
- }
-
- if (!is_null($params['from']))
- $this->addWhere('pl_title>=' . $db->addQuotes($this->titlePartToKey($params['from'])));
- if (isset ($params['prefix']))
- $this->addWhere("pl_title LIKE '" . $db->escapeLike($this->titlePartToKey($params['prefix'])) . "%'");
-
- $this->addFields(array (
+ if ( !is_null( $params['from'] ) ) {
+ $this->addWhere( 'pl_title>=' . $db->addQuotes( $this->titlePartToKey( $params['from'] ) ) );
+ }
+ if ( !is_null( $params['to'] ) ) {
+ $this->addWhere( 'pl_title<=' . $db->addQuotes( $this->titlePartToKey( $params['to'] ) ) );
+ }
+ if ( isset( $params['prefix'] ) ) {
+ $this->addWhere( 'pl_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+ }
+
+ $this->addFields( array(