Move thread list pagelinks into the threadlist templates. Also fix a few issues.