From f25769622e7698e9cb6431820eba17febea285e4 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 16 Apr 2009 16:31:29 +0000 Subject: [PATCH] * (bug 18449) Fixed items number per column on category pages when the total is divisible by 3 --- RELEASE-NOTES | 2 ++ includes/CategoryPage.php | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0092726b05..44c8a48fc8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -346,6 +346,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 18441) rebuildrecentchanges.inc no longer ignores $wgLogRestrictions * (bug 18317) Bolded selections in 1 | 3 | etc days on RecentChanges now use instead of hardcoded styles +* (bug 18449) Fixed items number per column on category pages when the total is + divisible by 3 == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 4ad2f3caa1..559f813fd1 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -362,7 +362,8 @@ class CategoryViewer { */ function columnList( $articles, $articles_start_char ) { // divide list into three equal chunks - $chunk = (int) (count ( $articles ) / 3); + $chunk = (int) ( count( $articles ) / 3 ); + $remaining = count( $articles ) % 3; // get and display header $r = ''; @@ -370,9 +371,9 @@ class CategoryViewer { $prev_start_char = 'none'; // loop through the chunks - for($startChunk = 0, $endChunk = $chunk, $chunkIndex = 0; + for( $startChunk = 0, $endChunk = $chunk, $chunkIndex = 0; $chunkIndex < 3; - $chunkIndex++, $startChunk = $endChunk, $endChunk += $chunk + 1) + $chunkIndex++, $startChunk = $endChunk, $endChunk += $remaining == 0 ? $chunk : $chunk + 1 ) { $r .= "
\n"; $atColumnTop = true; -- 2.20.1