https://bugzilla.wikimedia.org/show_bug.cgi?id=18449

           Summary: CategoryPage.php miscalculates number of articles in a
                    three-column list
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: patch
          Severity: enhancement
          Priority: Normal
         Component: Categories
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=6022)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?id=6022)
Screenshot

I noticed that the Category Page miscalculates the number of articles when
creating a three-column list. Here is an example (By the time I got it there
were 9 pages in this category):
http://www.mediawiki.org/wiki/Category:ArticleDelete_extensions 
Attached is also a screenshot.
I noticed that this only happens when then number of articles divided by 3 has
no remainder - like 9, 12, 27 and etc. I guess when we have 9 articles we
expect to have 3 in each column. Instead in the example you can see that we
have 3 in column 1, 4 in column 2 and 2 in column 3. 
When number of articles divided by 3 return a remainder the columns appears to
be created proportionally.
I looked in to the code and will suggest the following code change:
Page - includes/CategoryPage.php, line 374: 

// loop through the chunks
for($startChunk = 0, $endChunk = $chunk, $chunkIndex = 0;
    $chunkIndex < 3;
    $chunkIndex++, $startChunk = $endChunk, $endChunk += $chunk + 1)

to be changed to (the last line only is different)
// loop through the chunks
for($startChunk = 0, $endChunk = $chunk, $chunkIndex = 0;
    $chunkIndex < 3;
    $chunkIndex++, $startChunk = $endChunk, $endChunk += count($articles) % 3
== 0 ? $chunk : $chunk + 1)

I've did some testing and the patch appears to be working. Not sure however if
this code change can have other implications.

Thanks
Rado Tsanev


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to