fixed page title logic, added tests for page title