989e9e9b12ed78533ec686cac5c9907a55e7d37d
[lhc/web/wiklou.git] / includes / CategoryPage.php
1 <?php
2 /**
3 * Special handling for category description pages.
4 * Modelled after ImagePage.php.
5 *
6 * @file
7 */
8
9 if ( !defined( 'MEDIAWIKI' ) )
10 die( 1 );
11
12 /**
13 * Special handling for category description pages, showing pages,
14 * subcategories and file that belong to the category
15 */
16 class CategoryPage extends Article {
17 # Subclasses can change this to override the viewer class.
18 protected $mCategoryViewerClass = 'CategoryViewer';
19
20 function view() {
21 global $wgRequest, $wgUser;
22
23 $diff = $wgRequest->getVal( 'diff' );
24 $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
25
26 if ( isset( $diff ) && $diffOnly ) {
27 return parent::view();
28 }
29
30 if ( !wfRunHooks( 'CategoryPageView', array( &$this ) ) ) {
31 return;
32 }
33
34 if ( NS_CATEGORY == $this->mTitle->getNamespace() ) {
35 $this->openShowCategory();
36 }
37
38 parent::view();
39
40 if ( NS_CATEGORY == $this->mTitle->getNamespace() ) {
41 $this->closeShowCategory();
42 }
43 }
44
45 /**
46 * Don't return a 404 for categories in use.
47 * In use defined as: either the actual page exists
48 * or the category currently has members.
49 */
50 function hasViewableContent() {
51 if ( parent::hasViewableContent() ) {
52 return true;
53 } else {
54 $cat = Category::newFromTitle( $this->mTitle );
55 // If any of these are not 0, then has members
56 if ( $cat->getPageCount()
57 || $cat->getSubcatCount()
58 || $cat->getFileCount()
59 ) {
60 return true;
61 }
62 }
63 return false;
64 }
65
66 function openShowCategory() {
67 # For overloading
68 }
69
70 function closeShowCategory() {
71 global $wgOut, $wgRequest;
72
73 // Use these as defaults for back compat --catrope
74 $oldFrom = $wgRequest->getVal( 'from' );
75 $oldUntil = $wgRequest->getVal( 'until' );
76
77 $from = $until = array();
78 foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
79 $from[$type] = $wgRequest->getVal( "{$type}from", $oldFrom );
80 $until[$type] = $wgRequest->getVal( "{$type}until", $oldUntil );
81 }
82
83 $viewer = new $this->mCategoryViewerClass( $this->mTitle, $from, $until, $wgRequest->getValues() );
84 $wgOut->addHTML( $viewer->getHTML() );
85 }
86 }
87
88 class CategoryViewer {
89 var $limit, $from, $until,
90 $articles, $articles_start_char,
91 $children, $children_start_char,
92 $showGallery, $imgsNoGalley,
93 $imgsNoGallery_start_char,
94 $skin, $imgsNoGallery;
95
96 /**
97 * @var
98 */
99 var $nextPage;
100
101 /**
102 * @var Array
103 */
104 var $flip;
105
106 /**
107 * @var Title
108 */
109 var $title;
110
111 /**
112 * @var Collation
113 */
114 var $collation;
115
116 /**
117 * @var ImageGallery
118 */
119 var $gallery;
120
121 /**
122 * Category object for this page
123 * @var Category
124 */
125 private $cat;
126
127 /**
128 * The original query array, to be used in generating paging links.
129 * @var array
130 */
131 private $query;
132
133 function __construct( $title, $from = '', $until = '', $query = array() ) {
134 global $wgCategoryPagingLimit;
135 $this->title = $title;
136 $this->from = $from;
137 $this->until = $until;
138 $this->limit = $wgCategoryPagingLimit;
139 $this->cat = Category::newFromTitle( $title );
140 $this->query = $query;
141 $this->collation = Collation::singleton();
142 unset( $this->query['title'] );
143 }
144
145 /**
146 * Format the category data list.
147 *
148 * @return string HTML output
149 */
150 public function getHTML() {
151 global $wgOut, $wgCategoryMagicGallery, $wgContLang;
152 wfProfileIn( __METHOD__ );
153
154 $this->showGallery = $wgCategoryMagicGallery && !$wgOut->mNoGallery;
155
156 $this->clearCategoryState();
157 $this->doCategoryQuery();
158 $this->finaliseCategoryState();
159
160 $r = $this->getSubcategorySection() .
161 $this->getPagesSection() .
162 $this->getImageSection();
163
164 if ( $r == '' ) {
165 // If there is no category content to display, only
166 // show the top part of the navigation links.
167 // @todo FIXME: Cannot be completely suppressed because it
168 // is unknown if 'until' or 'from' makes this
169 // give 0 results.
170 $r = $r . $this->getCategoryTop();
171 } else {
172 $r = $this->getCategoryTop() .
173 $r .
174 $this->getCategoryBottom();
175 }
176
177 // Give a proper message if category is empty
178 if ( $r == '' ) {
179 $r = wfMsgExt( 'category-empty', array( 'parse' ) );
180 }
181
182 global $wgBetterDirectionality, $wgLang;
183 if( $wgBetterDirectionality ) {
184 $langAttribs = array( 'lang' => $wgLang->getCode(), 'dir' => $wgLang->getDir() );
185 $r = Html::rawElement( 'div', $langAttribs, $r );
186 }
187
188 wfProfileOut( __METHOD__ );
189 return $wgContLang->convert( $r );
190 }
191
192 function clearCategoryState() {
193 $this->articles = array();
194 $this->articles_start_char = array();
195 $this->children = array();
196 $this->children_start_char = array();
197 if ( $this->showGallery ) {
198 $this->gallery = new ImageGallery();
199 $this->gallery->setHideBadImages();
200 } else {
201 $this->imgsNoGallery = array();
202 $this->imgsNoGallery_start_char = array();
203 }
204 }
205
206 /**
207 * @return Skin
208 */
209 function getSkin() {
210 if ( !$this->skin ) {
211 global $wgUser;
212 $this->skin = $wgUser->getSkin();
213 }
214 return $this->skin;
215 }
216
217 /**
218 * Add a subcategory to the internal lists, using a Category object
219 */
220 function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
221 // Subcategory; strip the 'Category' namespace from the link text.
222 $title = $cat->getTitle();
223
224 $link = $this->getSkin()->link( $title, $title->getText() );
225 if ( $title->isRedirect() ) {
226 // This didn't used to add redirect-in-category, but might
227 // as well be consistent with the rest of the sections
228 // on a category page.
229 $link = '<span class="redirect-in-category">' . $link . '</span>';
230 }
231 $this->children[] = $link;
232
233 $this->children_start_char[] =
234 $this->getSubcategorySortChar( $cat->getTitle(), $sortkey );
235 }
236
237 /**
238 * Add a subcategory to the internal lists, using a title object
239 * @deprecated since 1.17 kept for compatibility, please use addSubcategoryObject instead
240 */
241 function addSubcategory( Title $title, $sortkey, $pageLength ) {
242 $this->addSubcategoryObject( Category::newFromTitle( $title ), $sortkey, $pageLength );
243 }
244
245 /**
246 * Get the character to be used for sorting subcategories.
247 * If there's a link from Category:A to Category:B, the sortkey of the resulting
248 * entry in the categorylinks table is Category:A, not A, which it SHOULD be.
249 * Workaround: If sortkey == "Category:".$title, than use $title for sorting,
250 * else use sortkey...
251 *
252 * @param Title $title
253 * @param string $sortkey The human-readable sortkey (before transforming to icu or whatever).
254 */
255 function getSubcategorySortChar( $title, $sortkey ) {
256 global $wgContLang;
257
258 if ( $title->getPrefixedText() == $sortkey ) {
259 $word = $title->getDBkey();
260 } else {
261 $word = $sortkey;
262 }
263
264 $firstChar = $this->collation->getFirstLetter( $word );
265
266 return $wgContLang->convert( $firstChar );
267 }
268
269 /**
270 * Add a page in the image namespace
271 */
272 function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) {
273 global $wgContLang;
274 if ( $this->showGallery ) {
275 $flip = $this->flip['file'];
276 if ( $flip ) {
277 $this->gallery->insert( $title );
278 } else {
279 $this->gallery->add( $title );
280 }
281 } else {
282 $link = $this->getSkin()->link( $title );
283 if ( $isRedirect ) {
284 // This seems kind of pointless given 'mw-redirect' class,
285 // but keeping for back-compatibility with user css.
286 $link = '<span class="redirect-in-category">' . $link . '</span>';
287 }
288 $this->imgsNoGallery[] = $link;
289
290 $this->imgsNoGallery_start_char[] = $wgContLang->convert(
291 $this->collation->getFirstLetter( $sortkey ) );
292 }
293 }
294
295 /**
296 * Add a miscellaneous page
297 */
298 function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
299 global $wgContLang;
300
301 $link = $this->getSkin()->link( $title );
302 if ( $isRedirect ) {
303 // This seems kind of pointless given 'mw-redirect' class,
304 // but keeping for back-compatiability with user css.
305 $link = '<span class="redirect-in-category">' . $link . '</span>';
306 }
307 $this->articles[] = $link;
308
309 $this->articles_start_char[] = $wgContLang->convert(
310 $this->collation->getFirstLetter( $sortkey ) );
311 }
312
313 function finaliseCategoryState() {
314 if ( $this->flip['subcat'] ) {
315 $this->children = array_reverse( $this->children );
316 $this->children_start_char = array_reverse( $this->children_start_char );
317 }
318 if ( $this->flip['page'] ) {
319 $this->articles = array_reverse( $this->articles );
320 $this->articles_start_char = array_reverse( $this->articles_start_char );
321 }
322 if ( !$this->showGallery && $this->flip['file'] ) {
323 $this->imgsNoGallery = array_reverse( $this->imgsNoGallery );
324 $this->imgsNoGallery_start_char = array_reverse( $this->imgsNoGallery_start_char );
325 }
326 }
327
328 function doCategoryQuery() {
329 $dbr = wfGetDB( DB_SLAVE, 'category' );
330
331 $this->nextPage = array(
332 'page' => null,
333 'subcat' => null,
334 'file' => null,
335 );
336 $this->flip = array( 'page' => false, 'subcat' => false, 'file' => false );
337
338 foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
339 # Get the sortkeys for start/end, if applicable. Note that if
340 # the collation in the database differs from the one
341 # set in $wgCategoryCollation, pagination might go totally haywire.
342 $extraConds = array( 'cl_type' => $type );
343 if ( $this->from[$type] !== null ) {
344 $extraConds[] = 'cl_sortkey >= '
345 . $dbr->addQuotes( $this->collation->getSortKey( $this->from[$type] ) );
346 } elseif ( $this->until[$type] !== null ) {
347 $extraConds[] = 'cl_sortkey < '
348 . $dbr->addQuotes( $this->collation->getSortKey( $this->until[$type] ) );
349 $this->flip[$type] = true;
350 }
351
352 $res = $dbr->select(
353 array( 'page', 'categorylinks', 'category' ),
354 array( 'page_id', 'page_title', 'page_namespace', 'page_len',
355 'page_is_redirect', 'cl_sortkey', 'cat_id', 'cat_title',
356 'cat_subcats', 'cat_pages', 'cat_files',
357 'cl_sortkey_prefix', 'cl_collation' ),
358 array_merge( array( 'cl_to' => $this->title->getDBkey() ), $extraConds ),
359 __METHOD__,
360 array(
361 'USE INDEX' => array( 'categorylinks' => 'cl_sortkey' ),
362 'LIMIT' => $this->limit + 1,
363 'ORDER BY' => $this->flip[$type] ? 'cl_sortkey DESC' : 'cl_sortkey',
364 ),
365 array(
366 'categorylinks' => array( 'INNER JOIN', 'cl_from = page_id' ),
367 'category' => array( 'LEFT JOIN', 'cat_title = page_title AND page_namespace = ' . NS_CATEGORY )
368 )
369 );
370
371 $count = 0;
372 foreach ( $res as $row ) {
373 $title = Title::newFromRow( $row );
374 if ( $row->cl_collation === '' ) {
375 // Hack to make sure that while updating from 1.16 schema
376 // and db is inconsistent, that the sky doesn't fall.
377 // See r83544. Could perhaps be removed in a couple decades...
378 $humanSortkey = $row->cl_sortkey;
379 } else {
380 $humanSortkey = $title->getCategorySortkey( $row->cl_sortkey_prefix );
381 }
382
383 if ( ++$count > $this->limit ) {
384 # We've reached the one extra which shows that there
385 # are additional pages to be had. Stop here...
386 $this->nextPage[$type] = $humanSortkey;
387 break;
388 }
389
390 if ( $title->getNamespace() == NS_CATEGORY ) {
391 $cat = Category::newFromRow( $row, $title );
392 $this->addSubcategoryObject( $cat, $humanSortkey, $row->page_len );
393 } elseif ( $title->getNamespace() == NS_FILE ) {
394 $this->addImage( $title, $humanSortkey, $row->page_len, $row->page_is_redirect );
395 } else {
396 $this->addPage( $title, $humanSortkey, $row->page_len, $row->page_is_redirect );
397 }
398 }
399 }
400 }
401
402 function getCategoryTop() {
403 $r = $this->getCategoryBottom();
404 return $r === ''
405 ? $r
406 : "<br style=\"clear:both;\"/>\n" . $r;
407 }
408
409 function getSubcategorySection() {
410 # Don't show subcategories section if there are none.
411 $r = '';
412 $rescnt = count( $this->children );
413 $dbcnt = $this->cat->getSubcatCount();
414 $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'subcat' );
415
416 if ( $rescnt > 0 ) {
417 # Showing subcategories
418 $r .= "<div id=\"mw-subcategories\">\n";
419 $r .= '<h2>' . wfMsg( 'subcategories' ) . "</h2>\n";
420 $r .= $countmsg;
421 $r .= $this->getSectionPagingLinks( 'subcat' );
422 $r .= $this->formatList( $this->children, $this->children_start_char );
423 $r .= $this->getSectionPagingLinks( 'subcat' );
424 $r .= "\n</div>";
425 }
426 return $r;
427 }
428
429 function getPagesSection() {
430 $ti = htmlspecialchars( $this->title->getText() );
431 # Don't show articles section if there are none.
432 $r = '';
433
434 # @todo FIXME: Here and in the other two sections: we don't need to bother
435 # with this rigamarole if the entire category contents fit on one page
436 # and have already been retrieved. We can just use $rescnt in that
437 # case and save a query and some logic.
438 $dbcnt = $this->cat->getPageCount() - $this->cat->getSubcatCount()
439 - $this->cat->getFileCount();
440 $rescnt = count( $this->articles );
441 $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'article' );
442
443 if ( $rescnt > 0 ) {
444 $r = "<div id=\"mw-pages\">\n";
445 $r .= '<h2>' . wfMsg( 'category_header', $ti ) . "</h2>\n";
446 $r .= $countmsg;
447 $r .= $this->getSectionPagingLinks( 'page' );
448 $r .= $this->formatList( $this->articles, $this->articles_start_char );
449 $r .= $this->getSectionPagingLinks( 'page' );
450 $r .= "\n</div>";
451 }
452 return $r;
453 }
454
455 function getImageSection() {
456 $r = '';
457 $rescnt = $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery );
458 if ( $rescnt > 0 ) {
459 $dbcnt = $this->cat->getFileCount();
460 $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'file' );
461
462 $r .= "<div id=\"mw-category-media\">\n";
463 $r .= '<h2>' . wfMsg( 'category-media-header', htmlspecialchars( $this->title->getText() ) ) . "</h2>\n";
464 $r .= $countmsg;
465 $r .= $this->getSectionPagingLinks( 'file' );
466 if ( $this->showGallery ) {
467 $r .= $this->gallery->toHTML();
468 } else {
469 $r .= $this->formatList( $this->imgsNoGallery, $this->imgsNoGallery_start_char );
470 }
471 $r .= $this->getSectionPagingLinks( 'file' );
472 $r .= "\n</div>";
473 }
474 return $r;
475 }
476
477 /**
478 * Get the paging links for a section (subcats/pages/files), to go at the top and bottom
479 * of the output.
480 *
481 * @param $type String: 'page', 'subcat', or 'file'
482 * @return String: HTML output, possibly empty if there are no other pages
483 */
484 private function getSectionPagingLinks( $type ) {
485 if ( $this->until[$type] !== null ) {
486 return $this->pagingLinks( $this->nextPage[$type], $this->until[$type], $type );
487 } elseif ( $this->nextPage[$type] !== null || $this->from[$type] !== null ) {
488 return $this->pagingLinks( $this->from[$type], $this->nextPage[$type], $type );
489 } else {
490 return '';
491 }
492 }
493
494 function getCategoryBottom() {
495 return '';
496 }
497
498 /**
499 * Format a list of articles chunked by letter, either as a
500 * bullet list or a columnar format, depending on the length.
501 *
502 * @param $articles Array
503 * @param $articles_start_char Array
504 * @param $cutoff Int
505 * @return String
506 * @private
507 */
508 function formatList( $articles, $articles_start_char, $cutoff = 6 ) {
509 $list = '';
510 if ( count ( $articles ) > $cutoff ) {
511 $list = self::columnList( $articles, $articles_start_char );
512 } elseif ( count( $articles ) > 0 ) {
513 // for short lists of articles in categories.
514 $list = self::shortList( $articles, $articles_start_char );
515 }
516 global $wgBetterDirectionality, $wgTitle;
517 if( $wgBetterDirectionality ) {
518 $pageLang = $wgTitle->getPageLanguage();
519 $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
520 $list = Html::rawElement( 'div', $attribs, $list );
521 }
522
523 return $list;
524 }
525
526 /**
527 * Format a list of articles chunked by letter in a three-column
528 * list, ordered vertically.
529 *
530 * TODO: Take the headers into account when creating columns, so they're
531 * more visually equal.
532 *
533 * More distant TODO: Scrap this and use CSS columns, whenever IE finally
534 * supports those.
535 *
536 * @param $articles Array
537 * @param $articles_start_char Array
538 * @return String
539 * @private
540 */
541 static function columnList( $articles, $articles_start_char ) {
542 $columns = array_combine( $articles, $articles_start_char );
543 # Split into three columns
544 $columns = array_chunk( $columns, ceil( count( $columns ) / 3 ), true /* preserve keys */ );
545
546 $ret = '<table width="100%"><tr valign="top"><td>';
547 $prevchar = null;
548
549 foreach ( $columns as $column ) {
550 $colContents = array();
551
552 # Kind of like array_flip() here, but we keep duplicates in an
553 # array instead of dropping them.
554 foreach ( $column as $article => $char ) {
555 if ( !isset( $colContents[$char] ) ) {
556 $colContents[$char] = array();
557 }
558 $colContents[$char][] = $article;
559 }
560
561 $first = true;
562 foreach ( $colContents as $char => $articles ) {
563 $ret .= '<h3>' . htmlspecialchars( $char );
564 if ( $first && $char === $prevchar ) {
565 # We're continuing a previous chunk at the top of a new
566 # column, so add " cont." after the letter.
567 $ret .= ' ' . wfMsgHtml( 'listingcontinuesabbrev' );
568 }
569 $ret .= "</h3>\n";
570
571 $ret .= '<ul><li>';
572 $ret .= implode( "</li>\n<li>", $articles );
573 $ret .= '</li></ul>';
574
575 $first = false;
576 $prevchar = $char;
577 }
578
579 $ret .= "</td>\n<td>";
580 }
581
582 $ret .= '</td></tr></table>';
583 return $ret;
584 }
585
586 /**
587 * Format a list of articles chunked by letter in a bullet list.
588 * @param $articles Array
589 * @param $articles_start_char Array
590 * @return String
591 * @private
592 */
593 static function shortList( $articles, $articles_start_char ) {
594 $r = '<h3>' . htmlspecialchars( $articles_start_char[0] ) . "</h3>\n";
595 $r .= '<ul><li>' . $articles[0] . '</li>';
596 for ( $index = 1; $index < count( $articles ); $index++ ) {
597 if ( $articles_start_char[$index] != $articles_start_char[$index - 1] ) {
598 $r .= "</ul><h3>" . htmlspecialchars( $articles_start_char[$index] ) . "</h3>\n<ul>";
599 }
600
601 $r .= "<li>{$articles[$index]}</li>";
602 }
603 $r .= '</ul>';
604 return $r;
605 }
606
607 /**
608 * Create paging links, as a helper method to getSectionPagingLinks().
609 *
610 * @param $first String The 'until' parameter for the generated URL
611 * @param $last String The 'from' parameter for the genererated URL
612 * @param $type String A prefix for parameters, 'page' or 'subcat' or
613 * 'file'
614 * @return String HTML
615 */
616 private function pagingLinks( $first, $last, $type = '' ) {
617 global $wgLang;
618 $sk = $this->getSkin();
619 $limitText = $wgLang->formatNum( $this->limit );
620
621 $prevLink = wfMsgExt( 'prevn', array( 'escape', 'parsemag' ), $limitText );
622
623 if ( $first != '' ) {
624 $prevQuery = $this->query;
625 $prevQuery["{$type}until"] = $first;
626 unset( $prevQuery["{$type}from"] );
627 $prevLink = $sk->linkKnown(
628 $this->title,
629 $prevLink,
630 array(),
631 $prevQuery
632 );
633 }
634
635 $nextLink = wfMsgExt( 'nextn', array( 'escape', 'parsemag' ), $limitText );
636
637 if ( $last != '' ) {
638 $lastQuery = $this->query;
639 $lastQuery["{$type}from"] = $last;
640 unset( $lastQuery["{$type}until"] );
641 $nextLink = $sk->linkKnown(
642 $this->title,
643 $nextLink,
644 array(),
645 $lastQuery
646 );
647 }
648
649 return "($prevLink) ($nextLink)";
650 }
651
652 /**
653 * What to do if the category table conflicts with the number of results
654 * returned? This function says what. Each type is considered independently
655 * of the other types.
656 *
657 * Note for grepping: uses the messages category-article-count,
658 * category-article-count-limited, category-subcat-count,
659 * category-subcat-count-limited, category-file-count,
660 * category-file-count-limited.
661 *
662 * @param $rescnt Int: The number of items returned by our database query.
663 * @param $dbcnt Int: The number of items according to the category table.
664 * @param $type String: 'subcat', 'article', or 'file'
665 * @return String: A message giving the number of items, to output to HTML.
666 */
667 private function getCountMessage( $rescnt, $dbcnt, $type ) {
668 global $wgLang;
669 # There are three cases:
670 # 1) The category table figure seems sane. It might be wrong, but
671 # we can't do anything about it if we don't recalculate it on ev-
672 # ery category view.
673 # 2) The category table figure isn't sane, like it's smaller than the
674 # number of actual results, *but* the number of results is less
675 # than $this->limit and there's no offset. In this case we still
676 # know the right figure.
677 # 3) We have no idea.
678
679 # Check if there's a "from" or "until" for anything
680
681 // This is a little ugly, but we seem to use different names
682 // for the paging types then for the messages.
683 if ( $type === 'article' ) {
684 $pagingType = 'page';
685 } else {
686 $pagingType = $type;
687 }
688
689 $fromOrUntil = false;
690 if ( $this->from[$pagingType] !== null || $this->until[$pagingType] !== null ) {
691 $fromOrUntil = true;
692 }
693
694 if ( $dbcnt == $rescnt || ( ( $rescnt == $this->limit || $fromOrUntil )
695 && $dbcnt > $rescnt ) ) {
696 # Case 1: seems sane.
697 $totalcnt = $dbcnt;
698 } elseif ( $rescnt < $this->limit && !$fromOrUntil ) {
699 # Case 2: not sane, but salvageable. Use the number of results.
700 # Since there are fewer than 200, we can also take this opportunity
701 # to refresh the incorrect category table entry -- which should be
702 # quick due to the small number of entries.
703 $totalcnt = $rescnt;
704 $this->cat->refreshCounts();
705 } else {
706 # Case 3: hopeless. Don't give a total count at all.
707 return wfMsgExt( "category-$type-count-limited", 'parse',
708 $wgLang->formatNum( $rescnt ) );
709 }
710 return wfMsgExt(
711 "category-$type-count",
712 'parse',
713 $wgLang->formatNum( $rescnt ),
714 $wgLang->formatNum( $totalcnt )
715 );
716 }
717 }