It’s best to put the PHP include files somewhere they are not publicly accessible.
In you index, the path shows a pages folder within the public root folder. That can work, but you probably want to protect that folder from public access which can be done via a config file (such as htaccess in Apache).
Though I prefer to put includes in a private folder below the public root. If you do that, you will need to alter the paths in your index to suit.