Fixed bug where $query param wasn't passed to getPageList()

I also removed the closing php tag at the end of the file because this is a best practice for security reasons (see http://stackoverflow.com/questions/4410704/php-closing-tag , and a million others)