Adds variable to tell if page has children

No need to add the $language parameter two times. You can just use ```AND p.language = i.language``` instead off ```AND p.language = ?``` in the JOIN statement.