Index: trunk/phase3/includes/CategoryPage.php |
— | — | @@ -593,8 +593,8 @@ |
594 | 594 | |
595 | 595 | /** |
596 | 596 | * What to do if the category table conflicts with the number of results |
597 | | - * returned? This function says what. It works the same whether the |
598 | | - * things being counted are articles, subcategories, or files. |
| 597 | + * returned? This function says what. Each type is considered independantly |
| 598 | + * of the other types. |
599 | 599 | * |
600 | 600 | * Note for grepping: uses the messages category-article-count, |
601 | 601 | * category-article-count-limited, category-subcat-count, |
— | — | @@ -617,24 +617,28 @@ |
618 | 618 | # than $this->limit and there's no offset. In this case we still |
619 | 619 | # know the right figure. |
620 | 620 | # 3) We have no idea. |
621 | | - $totalrescnt = count( $this->articles ) + count( $this->children ) + |
622 | | - ( $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery ) ); |
623 | 621 | |
624 | 622 | # Check if there's a "from" or "until" for anything |
| 623 | + |
| 624 | + // This is a little ugly, but we seem to use different names |
| 625 | + // for the paging types then for the messages. |
| 626 | + if ( $type === 'article' ) { |
| 627 | + $pagingType = 'page'; |
| 628 | + } else { |
| 629 | + $pagingType = $type; |
| 630 | + } |
| 631 | + |
625 | 632 | $fromOrUntil = false; |
626 | | - foreach ( array( 'page', 'subcat', 'file' ) as $t ) { |
627 | | - if ( $this->from[$t] !== null || $this->until[$t] !== null ) { |
628 | | - $fromOrUntil = true; |
629 | | - break; |
630 | | - } |
| 633 | + if ( $this->from[$pagingType] !== null || $this->until[$pagingType] !== null ) { |
| 634 | + $fromOrUntil = true; |
631 | 635 | } |
632 | 636 | |
633 | | - if ( $dbcnt == $rescnt || ( ( $totalrescnt == $this->limit || $fromOrUntil ) |
| 637 | + if ( $dbcnt == $rescnt || ( ( $rescnt == $this->limit || $fromOrUntil ) |
634 | 638 | && $dbcnt > $rescnt ) ) |
635 | 639 | { |
636 | 640 | # Case 1: seems sane. |
637 | 641 | $totalcnt = $dbcnt; |
638 | | - } elseif ( $totalrescnt < $this->limit && !$fromOrUntil ) { |
| 642 | + } elseif ( $rescnt < $this->limit && !$fromOrUntil ) { |
639 | 643 | # Case 2: not sane, but salvageable. Use the number of results. |
640 | 644 | # Since there are fewer than 200, we can also take this opportunity |
641 | 645 | # to refresh the incorrect category table entry -- which should be |