[% IF !param.exists("max_pnp_sources") %][% param.max_pnp_sources = 1 %][% END %]
[% IF param.max_pnp_sources > 1 %]
  [% modulus = (param.max_pnp_sources - 1) mod 3 %]
  [% IF modulus == 0 %]
    [% nb_page = (param.max_pnp_sources - 1) div 3 %]
  [% ELSE %]
    [% nb_page = ( (param.max_pnp_sources - 1) div 3 ) + 1 %]
  [% END %]
  [% page = 1 %]
  [% source = get_graph_source(hst, svc) + 1 %][%# start at default source + 1 because the first graph is added in sla_graph_page.tt already #%]
  [% WHILE page <= nb_page %]
    [% nb_graph = 0 %]
    [% pnpdata = get_pnp_image(hst, svc, start, end, 400, 100, source) %]
    [% IF pnpdata %]
      [% nb_graph = nb_graph + 1 %]
      [% WRAPPER 'reports/comp/page_standard.tt' pagetitle="" %]
        <div align="center">
          <img src="[% pnpdata %]" class="[% c.stash.last_graph_type %]image" alt="[% c.stash.last_graph_type %] graph">
        </div>
        [% source = source + 1 %]
        [% IF source >= param.max_pnp_sources %]
          [% nb_graph = 3 %]
        [% END %]
        [% WHILE nb_graph < 3 %]
          [% pnpdata = get_pnp_image(hst, svc, start, end, 400, 100, source) %]
          [% IF pnpdata %]
            [% nb_graph = nb_graph + 1 %]
            <div align="center">
              <img src="[% pnpdata %]" class="[% c.stash.last_graph_type %]image" alt="[% c.stash.last_graph_type %] graph">
            </div>
          [% END %]
          [% source = source + 1 %]
          [% IF source >= param.max_pnp_sources %]
            [% nb_graph = 3 %]
          [% END %]
        [% END %]
      [% END %]
    [% END %]
    [% page = page + 1 %]
  [% END %]
[% END %]
