This is due to a Windows API limit. For non-Unicode applications, the maximum path for a file is 256 characters. The only solution I can think of would be to make mIRC chop the filename length to the maximum allowed. However that would result in one log file being used for all channel/query names longer than this maximum length.