Removed pages.php
Made some changes to getPages() function.
Made page_index variable to be proccesed by javascript.