Split wiki history generator out into separate file

This is to enable it to be called from regen.php without having
to shell out to php.
Extract wiki/pages.md.html generator into separate file

This is to enable the regen.php file to invoke the same functions
without needing to shell out to php.
Fix error where variable was not found

I removed the $path variable (which is just distracting), and
neglected to remove references to it.
Reinstate path variable

Just in case the wiki moves somewhere else at some point.