Defines file pointer for the unknownfiltype.log. This file pointer is only used when compiled in debug mode, so it was probably deleted in a previous code cleaning.
Removed uncommented code.
Do the check for enough buffer space before we uses the buffer, not after. As the code was we sometime overflowed documentfinishedbuf buffer with up to 512 bytes.