This subtemplate of {{BOOKPAGENAME}} handles all cases where the page is actually part of the book.

The two parameters expected are namespace and pagename.

This template handles most in-book cases directly, but dispatches the more complicated case of pages in userspace to {{BOOKPAGENAME/user}}.