$page->isAncestorOf($child)

Checks if the page is a direct or indirect ancestor of the given $page object.