+ foreach ( $titles as $title ) {
+ $titleObj = is_string( $title ) ? Title::newFromText( $title ) : $title;
+ if ( !$titleObj ) {
+ // Handle invalid titles gracefully
+ $this->mAllpages[0][$title] = $this->mFakePageId;
+ $this->mInvalidTitles[$this->mFakePageId] = $title;
+ $this->mFakePageId--;
+ continue; // There's nothing else we can do
+ }
+ $unconvertedTitle = $titleObj->getPrefixedText();
+ $titleWasConverted = false;
+ $iw = $titleObj->getInterwiki();
+ if ( strval( $iw ) !== '' ) {
+ // This title is an interwiki link.
+ $this->mInterwikiTitles[$titleObj->getPrefixedText()] = $iw;
+ } else {
+ // Variants checking
+ global $wgContLang;
+ if ( $this->mConvertTitles &&
+ count( $wgContLang->getVariants() ) > 1 &&
+ !$titleObj->exists() ) {
+ // Language::findVariantLink will modify titleObj into
+ // the canonical variant if possible
+ $wgContLang->findVariantLink( $title, $titleObj );
+ $titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
+ }