Fixing the bug in which the urlname of an invisible page would get corrupted while sorting and updated the tests