Thanks to many suggestions, and even a few patches, and some
encouragement, most of the annoying bits of rt2stats have been fixed:
Also, jesse has shown me how to integrate this into RT2 properly, and I
will try to do this as soon as I have more free time. For the immediate
future, this will remain a standalone cgi.