anchor.diff:                      <%
                           if ("outages".equals(mode)) {
                       %>
  -                    <a href="<%=request.getRequestURI()%>?mode=alarms&amp;heatmap=<%=heatmap%>&amp;category=<%=category%>&amp;foreignSource=<%=foreignSource%>&amp;monitoredService=<%=monitoredService%>">Alarms</a> / <b>Outages</b>
  -                    <%
  -                    } else {
  -                    %>
  -                    <b>Alarms</b> / <a href="<%=request.getRequestURI()%>?mode=outages&amp;heatmap=<%=heatmap%>&amp;category=<%=category%>&amp;foreignSource=<%=foreignSource%>&amp;monitoredService=<%=monitoredService%>">Outages</a>
  +                    <a href="<%=request.getRequestURI()%>?mode=alarms&amp;heatmap=<%=Util.encode(heatmap)%>&amp;category=<%=category==null?"":Util.encode(category)%>&amp;foreignSource=<%=foreignSource==null?"":Util.encode(foreignSource)%>&amp;monitoredService=<%=monitoredService==null?"":Util.encode(monitoredService)%>">Alarms</a> / <b>Outages</b>
  +                    <%
  +                    } else {
  +                    %>
  +                    <b>Alarms</b> / <a href="<%=request.getRequestURI()%>?mode=outages&amp;heatmap=<%=Util.encode(heatmap)%>&amp;category=<%=category==null?"":Util.encode(category)%>&amp;foreignSource=<%=foreignSource==null?"":Util.encode(foreignSource)%>&amp;monitoredService=<%=monitoredService==null?"":Util.encode(monitoredService)%>">Outages</a>
                       <%
                           }
                       %>
  
positive.code:                     <%
                        if ("foreignSources".equals(heatmap)) {
                      %>
                      location.href = "<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=nodesByForeignSource&foreignSource=" + nodes[0].id;
                      <%
                        }
  
                        if ("categories".equals(heatmap)) {
                      %>
                      location.href = "<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=nodesByCategory&category=" + nodes[0].id;
                      <%
                        }
  
                        if ("monitoredServices".equals(heatmap)) {
                      %>
                      location.href = "<%=request.getRequestURI()%>?mode=<%=mode%>&heatmap=nodesByMonitoredService&monitoredService=" + nodes[0].id;
                      <%
                        }
  
                        if ("nodesByCategory".equals(heatmap) || "nodesByForeignSource".equals(heatmap) || "nodesByMonitoredService".equals(heatmap)) {
                      %>
                      location.href = "/opennms/element/node.jsp?node=" + nodes[0].elementId
                      <%
                        }
                      %>
  
negative.code:     String url = "/opennms/rest/heatmap/";
  
      if (request.getParameterMap().containsKey("mode")) {
          mode = request.getParameter("mode");
      }
  
      if (request.getParameterMap().containsKey("heatmap")) {
          heatmap = request.getParameter("heatmap");
      }
  
      if ("services".equals(heatmap)) {
  