correctly count the total number of pages
update phpdoc
Do not check links to ids on the same page
always close the curl handle
Improve speed and memory useage by only requesting the header