Improved start/end page metadata

Added additional conditions, so starting/ending page metadata tags won't
be included if the getStartingPage and getEndingPage functions don't
return any data.