Modified category sort logic to fit 7db86c6
* correct sorting by size requires the "data-type" attribute to be set to "number"
* pages are now first sorted as two halves
** descending / ascending respectively
* the sorted set is then split into actual halves
* the output loop alternates between these halves
* changed test for existance to actual test for existance instead of calculating it by ourselfes