Fixing the bug in which the urlname of an invisible page would get corru...

Fixing the bug in which invisible pages would see their urlnames become corrupted while sorting and updated the tests.