Forum:Sorting template

Hello, I created this template to controlling the sorting of progressive files and pages in a category, especially to avoid that "Page 10" will be sorted before "Page 2". I used the DEFAULTSORT magic word, but I cannot understand why it's not working properly since if you try to see what sorting keys is used, there shouldn't be any problem.