The code below seems to change too many things and could be simplified a lot.

Instead of calling `$this->setHeader()` I would buffer the headers that will be sent. At the end calculate the size, get the size of headers already sent using http://www.php.net/manual/en/function.headers-list.php and if header size exceeds maximum from option (if option set), log the truncation message.