URL-escape the main page link on the logo
[mediawiki.git] / includes / SpecialShortpages.php
blobffdd65fb0fdcb508acf61e8a9c33b55d044bd23c
1 <?
3 function wfSpecialShortpages()
5 global $wgUser, $wgOut, $wgLang, $wgTitle;
6 $fname = "wfSpecialShortpages";
8 # Cache
9 $vsp = $wgLang->getValidSpecialPages();
10 $log = new LogPage( $vsp["Shortpages"] );
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, LENGTH(cur_text) AS len FROM cur " .
22 "WHERE cur_namespace=0 AND cur_is_redirect=0 ORDER BY " .
23 "LENGTH(cur_text) LIMIT {$offset}, {$limit}";
24 $res = wfQuery( $sql, $fname );
26 $top = wfShowingResults( $offset, $limit );
27 $wgOut->addHTML( "<p>{$top}\n" );
29 $sl = wfViewPrevNext( $offset, $limit,
30 $wgLang->specialPage( "Shortpages" ) );
31 $wgOut->addHTML( "<br>{$sl}\n" );
33 $sk = $wgUser->getSkin();
34 $s = "<ol start=" . ( $offset + 1 ) . ">";
35 while ( $obj = wfFetchObject( $res ) ) {
36 $nb = str_replace( "$1", $obj->len, wfMsg( "nbytes" ) );
37 $link = $sk->makeKnownLink( $obj->cur_title, "" );
38 $s .= "<li>{$link} ({$nb})</li>\n";
40 wfFreeResult( $res );
41 $s .= "</ol>";
42 $wgOut->addHTML( $s );
43 $wgOut->addHTML( "<p>{$sl}\n" );
46 # Saving cache
47 if ( $offset > 0 OR $limit < 50 ) return ; #Not suitable
48 $log->replaceContent( $s );