Fixed XSS vulnerability, updated API to handle pages