Starting/ending page functions, improved metadata

Added two functions, returning starting page of an article and ending
page of an article. Improved metadata generation using those functions.