Default empty $pages to range array

This removes some code duplication and imho makes the code somewhat more readable.