Optimised queries for Page#nested_url and Page#path

This makes use of ancestors instead of iterating through all parents.
This means one database query, not several.

Fixes #2087
Made arguments to Page#path more sensible.
Merge pull request #2752 from refinery/performance/reduce-queries-for-pages-menu

Optimised queries for Page#nested_url and Page#path