Update syntax.php to support deleted, moved pages

Update syntax.php to support deleted, moved pages. Basically pages must still exist to be displayed. Modified the code starting on line 181, by replacing the for function.