Added setHashLength() and stuff for Table of Contents. Also add some type
casting and html escaping for title stuff. Not so much for security as just
trying to keep normal stuff from breaking it.
Added some more escaping to message text.