do you really need this ? you could simply count ``$this->data['messages']`` at display time