Various additions and fixes
[mediawiki.git] / includes / SpecialLonelypages.php
blob35db75360a5942c887870c0b645354d275ff15ee
1 <?
3 function wfSpecialLonelypages()
5 global $wgUser, $wgOut, $wgLang, $wgTitle;
6 $fname = "wfSpecialLonelypages";
8 # Cache
9 $vsp = $wgLang->getValidSpecialPages();
10 $log = new LogPage( $vsp["Lonelypages"] );
11 $log->mUpdateRecentChanges = false;
13 global $wgMiserMode;
14 if ( $wgMiserMode ) {
15 $log->showAsDisabledPage();
16 return;
19 list( $limit, $offset ) = wfCheckLimits();
21 $sql = "SELECT cur_title FROM cur LEFT JOIN links ON " .
22 "cur_id=l_to WHERE l_to IS NULL AND cur_namespace=0 AND " .
23 "cur_is_redirect=0 ORDER BY cur_title LIMIT {$offset}, {$limit}";
24 $res = wfQuery( $sql, $fname );
26 $sk = $wgUser->getSkin();
28 $top = wfShowingResults( $offset, $limit );
29 $wgOut->addHTML( "<p>{$top}\n" );
31 $sl = wfViewPrevNext( $offset, $limit,
32 $wgLang->specialPage( "Lonelypages" ) );
33 $wgOut->addHTML( "<br>{$sl}\n" );
35 $s = "<ol start=" . ( $offset + 1 ) . ">";
36 while ( $obj = wfFetchObject( $res ) ) {
37 $link = $sk->makeKnownLink( $obj->cur_title, "" );
38 $s .= "<li>{$link}</li>\n";
40 wfFreeResult( $res );
41 $s .= "</ol>";
42 $wgOut->addHTML( $s );
43 $wgOut->addHTML( "<p>{$sl}\n" );
45 # Saving cache
46 if ( $offset > 0 OR $limit < 50 ) return ; #Not suitable
47 $log->replaceContent( $s );