+ $this->addOption( 'LIMIT', $params['limit'] + 1 );
+ $res = $this->select( __METHOD__ );
+
+ $count = 0;
+ foreach ( $res as $row ) {
+ if ( ++$count > $params['limit'] ) {
+ // We've reached the one extra which shows that
+ // there are additional pages to be had. Stop here...
+ $this->setContinueEnumParameter( 'continue', "{$row->ll_from}|{$row->ll_lang}" );
+ break;
+ }
+ $entry = [ 'lang' => $row->ll_lang ];
+ if ( isset( $prop['url'] ) ) {
+ $title = Title::newFromText( "{$row->ll_lang}:{$row->ll_title}" );
+ if ( $title ) {
+ $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
+ }
+ }
+ if ( isset( $prop['langname'] ) ) {
+ $entry['langname'] = Language::fetchLanguageName( $row->ll_lang, $params['inlanguagecode'] );
+ }
+ if ( isset( $prop['autonym'] ) ) {
+ $entry['autonym'] = Language::fetchLanguageName( $row->ll_lang );
+ }
+ ApiResult::setContentValue( $entry, 'title', $row->ll_title );
+ $fit = $this->addPageSubItem( $row->ll_from, $entry );
+ if ( !$fit ) {
+ $this->setContinueEnumParameter( 'continue', "{$row->ll_from}|{$row->ll_lang}" );
+ break;
+ }
+ }