<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,5 @@
 = History
+* v0.1.6. Good with SafeERB now. Added indexes to the clientperf tables.
 * v0.1.3. Another timezone fix...
 * v0.1.2. Use ActiveRecord::Base.default_timezone when trying to format dateparts, thanks Mike Perham
 * v0.1.1. Fixed error when there is no data at all, thanks Mike Perham</diff>
      <filename>History.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -27,7 +27,7 @@ module Clientperf
     end
     
     def version
-      &quot;0.1.5&quot;
+      &quot;0.1.6&quot;
     end
     
     private</diff>
      <filename>lib/clientperf.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,17 @@
 module ClientperfHelper
-  def chart(data)
-    &quot;http://chart.apis.google.com/chart?cht=ls&amp;chs=300x100&amp;chm=B,e6f2fa,0,0,0|R,000000,0,0.998,1.0&amp;chco=0f7fcf&amp;chxt=r&amp;chd=s:#{chart_data(data)}&quot;
+  def chart_for(data)
+    if encoded = chart_data(data)
+      image_tag(&quot;http://chart.apis.google.com/chart?cht=ls&amp;chs=300x100&amp;chm=B,e6f2fa,0,0,0|R,000000,0,0.998,1.0&amp;chco=0f7fcf&amp;chxt=r&amp;chd=s:#{encoded}&quot;)
+    else
+      content_tag('p', &quot;no data for this chart&quot;)
+    end
   end
   
   private
   
   def chart_data(args)
     data, max = args
+    return nil if max == 0 || data.size == 0
     max += max * 0.1
     encode = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
 </diff>
      <filename>lib/clientperf_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 class ClientperfMigrations
-  MIGRATION_NAMES = %w(add_clientperf_tables)
+  MIGRATION_NAMES = %w(add_clientperf_tables add_clientperf_indexes)
   MIGRATION_CONTENTS = {
     :add_clientperf_tables =&gt; %(
 class AddClientperfTables &lt; ActiveRecord::Migration
@@ -20,6 +20,18 @@ class AddClientperfTables &lt; ActiveRecord::Migration
     drop_table :clientperf_uris
     drop_table :clientperf_results
   end
+end),
+    :add_clientperf_indexes =&gt; %(
+class AddClientperfIndexes &lt; ActiveRecord::Migration
+  def self.up
+    add_index :clientperf_uris, :uri
+    add_index :clientperf_results, :clientperf_uri_id
+  end
+
+  def self.down
+    remove_index :clientperf_uris, :uri
+    remove_index :clientperf_results, :clientperf_uri_id
+  end
 end)
   }
   </diff>
      <filename>lib/clientperf_migrations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@
 			&lt;% @uris.each do |uri| %&gt;
 			&lt;tr&gt;
 				&lt;td class=&quot;vital-stats&quot;&gt;[ &lt;%= number_with_precision(uri.clientperf_results.average(:milliseconds) / 1000.to_f, 2) %&gt;s | &lt;%= uri.clientperf_results.count %&gt; ]&lt;/td&gt;
-				&lt;td&gt;&lt;%= link_to uri.uri, &quot;/clientperf/#{uri.id}&quot; %&gt;&lt;/td&gt;
+				&lt;td&gt;&lt;%= link_to h(uri.uri), &quot;/clientperf/#{uri.id}&quot; %&gt;&lt;/td&gt;
 			&lt;/tr&gt;
 			&lt;% end %&gt;
 		&lt;/table&gt;
@@ -17,11 +17,11 @@
 		&lt;% if @uris.size &gt; 0 %&gt;
 		&lt;div class=&quot;chart&quot;&gt;
 			&lt;h4&gt;24 hour&lt;/h4&gt;
-			&lt;img src=&quot;&lt;%= chart(ClientperfResult.last_24_hours) %&gt;&quot; /&gt;
+			&lt;%= chart_for(ClientperfResult.last_24_hours) %&gt;
 		&lt;/div&gt;
 		&lt;div class=&quot;chart&quot;&gt;
 			&lt;h4&gt;30 day&lt;/h4&gt;
-			&lt;img src=&quot;&lt;%= chart(ClientperfResult.last_30_days)%&gt;&quot; /&gt;
+			&lt;%= chart_for(ClientperfResult.last_30_days) %&gt;
 		&lt;/div&gt;
 		&lt;% else %&gt;
 			&lt;p&gt;no data yet.&lt;/p&gt;</diff>
      <filename>views/clientperf/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -3,11 +3,11 @@
 		&lt;h2&gt;trends&lt;/h2&gt;
 		&lt;div class=&quot;chart&quot;&gt;
 			&lt;h4&gt;24 hour&lt;/h4&gt;
-			&lt;img src=&quot;&lt;%= chart(@uri.last_24_hours) %&gt;&quot; /&gt;
+			&lt;%= chart_for(@uri.last_24_hours) %&gt;
 		&lt;/div&gt;
 		&lt;div class=&quot;chart&quot;&gt;
 			&lt;h4&gt;30 day&lt;/h4&gt;
-			&lt;img src=&quot;&lt;%= chart(@uri.last_30_days)%&gt;&quot; /&gt;
+			&lt;%= chart_for(@uri.last_30_days)%&gt;
 		&lt;/div&gt;	
 	&lt;/div&gt;
 &lt;/div&gt;</diff>
      <filename>views/clientperf/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 &lt;html&gt;
 	&lt;head&gt;
-		&lt;title&gt;clientperf &lt;%= &quot;: #{@page_title}&quot; if @page_title %&gt;&lt;/title&gt;
+		&lt;title&gt;clientperf &lt;%= &quot;: #{h(@page_title)}&quot; if @page_title %&gt;&lt;/title&gt;
 		&lt;style type=&quot;text/css&quot;&gt;
 			body {
 				margin:0; 
@@ -95,7 +95,7 @@
 	&lt;body&gt;
 		&lt;div id=&quot;header&quot;&gt;
 			&lt;h1&gt;&lt;%= link_to &quot;clientperf&quot;, :controller =&gt; 'clientperf', :action =&gt; 'index' %&gt;&lt;/h1&gt;
-			&lt;%= &quot;&lt;h3&gt;&lt;span&gt;&amp;raquo;&lt;/span&gt;#{@uri.uri}&lt;/h3&gt;&quot; if @uri %&gt;
+			&lt;%= &quot;&lt;h3&gt;&lt;span&gt;&amp;raquo;&lt;/span&gt;#{h(@uri.uri)}&lt;/h3&gt;&quot; if @uri %&gt;
 			&lt;div style=&quot;clear:both&quot;&gt;&lt;/div&gt;
 		&lt;/div&gt;
 		&lt;div id=&quot;content&quot;&gt;</diff>
      <filename>views/layouts/clientperf.html.erb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>154292e9644cb7a7ecab29fa9d6d973eebc2c2d0</id>
    </parent>
  </parents>
  <author>
    <name>Eric Falcao</name>
    <email>efalcao@gmail.com</email>
  </author>
  <url>http://github.com/efalcao/clientperf/commit/c538352522e44a39803ef229823b20ec800de16e</url>
  <id>c538352522e44a39803ef229823b20ec800de16e</id>
  <committed-date>2008-06-29T15:53:23-07:00</committed-date>
  <authored-date>2008-06-29T15:53:23-07:00</authored-date>
  <message>h()'d stuff to comply with SafeERB. Added migrations to tables</message>
  <tree>246ad01c1c697a4dd062bc367ac6595688099034</tree>
  <committer>
    <name>Eric Falcao</name>
    <email>efalcao@gmail.com</email>
  </committer>
</commit>
