Last modified: 2011-03-13 18:04:41 UTC
Created attachment 4785 [details] proposed patch The actual displayed list of Special:Whatlinkshere is a bit messy, since pages are being sorted by page_id. With the current DB structure, it seems to me that it would be costly to alter the SQL queries to sort the results in any way. This patch performs a manual usort() on the resulting set, after it has been truncated to $limit (the number of pages to show). It does not alter which pages are being shown on each page : It only alters the sorting display on a per page basis. Namespace first, template transclusion second : The page is now sorted by namespace, and pages where the target page is trancluded come last. Cheers :)
Well, the problem here is that there's still no ordering from page to page; sorting within the page would imply a sensible overall ordering which doesn't exist.
Further up the page, the array is ksort()'d. What if after that was done, a normal sort ( $rows , SORT_STRING) was run to order the list before outputting it. I might be way off the mark here though.
Sorting by page_id looks fine here. Note there are also filters to only get certain inclusion/link types.