- (int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
- pos, true, INT_MAX, m_PageBreaks, m_NumPages);
- m_PageBreaks[++m_NumPages] = pos;
+ (int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
+ m_PageBreaks,
+ pos, true, INT_MAX);
+ m_PageBreaks.Add( pos);
+ if( m_PageBreaks.GetCount() > wxHTML_PRINT_MAX_PAGES)
+ {
+ wxMessageBox( _("HTML pagination algorithm generated more than the allowed maximum number of pages and it can't continue any longer!"),
+ _("Warning"), wxCANCEL | wxICON_ERROR );
+ break;
+ }