diff --git a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java
index ede694f1d4ec549af73a2bcfa352759e5368a2c1..2d676bdacffc8cda2a6bf3e55aa877f88d674702 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java
@@ -25,6 +25,9 @@ public class GraphHelper extends HelperBase {
     private static final int DEFAULT_Y = 100;
     private static final int DEFAULT_REFRESH = 60;
     private static final int DEFAULT_PERIODS = 60;
+    static final int MAX_X = 2048;
+    static final int MAX_Y = 1024;
+    private static final int MIN_REFRESH = 15;
     
     public GraphHelper() {
     }
@@ -45,13 +48,13 @@ public class GraphHelper extends HelperBase {
     }
     public void setShowEvents(boolean b) { _showEvents = b; }
     public void setHeight(String str) {
-        try { _height = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
+        try { _height = Math.min(Integer.parseInt(str), MAX_Y); } catch (NumberFormatException nfe) {}
     }
     public void setWidth(String str) {
-        try { _width = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
+        try { _width = Math.min(Integer.parseInt(str), MAX_X); } catch (NumberFormatException nfe) {}
     }
     public void setRefreshDelay(String str) {
-        try { _refreshDelaySeconds = Integer.parseInt(str); } catch (NumberFormatException nfe) {}
+        try { _refreshDelaySeconds = Math.max(Integer.parseInt(str), MIN_REFRESH); } catch (NumberFormatException nfe) {}
     }
     
     public String getImages() { 
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java b/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java
index 4b29475a1c4e73a3e218a45e559d5756ddf32e53..15232fbcc88574fec2383f93dabe2c8c3a78a9e5 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java
@@ -119,6 +119,10 @@ public class StatSummarizer implements Runnable {
         return renderPng(rate, out, -1, -1, false, false, false, false, -1, true); 
     }
     public boolean renderPng(Rate rate, OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, boolean showCredit) throws IOException {
+        if (width > GraphHelper.MAX_X)
+            width = GraphHelper.MAX_X;
+        if (height > GraphHelper.MAX_Y)
+            height = GraphHelper.MAX_Y;
         for (int i = 0; i < _listeners.size(); i++) {
             SummaryListener lsnr = (SummaryListener)_listeners.get(i);
             if (lsnr.getRate().equals(rate)) {
@@ -147,6 +151,10 @@ public class StatSummarizer implements Runnable {
     
     public boolean renderRatePng(OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, boolean showCredit) throws IOException {
         long end = _context.clock().now() - 60*1000;
+        if (width > GraphHelper.MAX_X)
+            width = GraphHelper.MAX_X;
+        if (height > GraphHelper.MAX_Y)
+            height = GraphHelper.MAX_Y;
         if (periodCount <= 0) periodCount = SummaryListener.PERIODS;
         if (periodCount > SummaryListener.PERIODS)
             periodCount = SummaryListener.PERIODS;