$count = 0;
foreach ( $res as $row ) {
$title = Title::newFromRow( $row );
- $rawSortkey = $row->cl_sortkey_prefix . $title->getCategorySortkey();
+ $rawSortkey = $title->getCategorySortkey( $row->cl_sortkey_prefix );
if ( ++$count > $this->limit ) {
# We've reached the one extra which shows that there