To check page exist you can use global $pagesArray variable, it contains cached page data:
Another, quicker option would be to check it manually with native file_exist() PHP method, for example:
PS. Do not forget to sanitize the user input!
Code:
global $pagesArray;
if(isset($pagesArray[$slug])) echo 'Page exist';
else echo 'Page does not exist';
Another, quicker option would be to check it manually with native file_exist() PHP method, for example:
Code:
if(file_exists(GSDATAPAGESPATH.$slug.'.xml')) echo 'Page exist';
else echo 'Page does not exist';
PS. Do not forget to sanitize the user input!