<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -36,7 +36,7 @@ class ArticlesController &lt; ApplicationController
     @article         = Article.load_with_comments_and_tags(params[:id])
     author           = @article.user
     # these are displayed in the sidebar
-    @latest_articles = author.articles.recent_articles
+    @latest_articles = author.articles.recent_articles(params[:page])
     @tagz            = author.tagz
     # anti spam for comment posting
     @antispam        = random_antispam_question</diff>
      <filename>app/controllers/articles_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -31,9 +31,9 @@ private
     # first, find the user who owns this subdomain
     author = User.find_by_username(@current_subdomain)
     # find the articles for this author, with the specified tag if any
-    @articles = Article.find_by_tag_and_author(params[:tag], author)
+    @articles = Article.find_by_tag_and_author(params[:tag], author, params[:page])
     # these are displayed in the sidebar
-    @latest_articles = author.articles.recent_articles
+    @latest_articles = author.articles.recent_articles(params[:page])
     @tagz            = author.tagz
   end
   
@@ -45,15 +45,15 @@ private
       category    = params[:category].nil? ? '' : Category.find_by_id(params[:category])
       # load most recent articles
       if params[:s]
-        @articles = Article.filtered_articles(params[:s])
+        @articles = Article.filtered_articles(params[:page], params[:s])
       else
-        @articles = Article.recent_articles(category)
+        @articles = Article.recent_articles(params[:page], category)
       end
     end
     # load most used categories
     @categories   = Category.most_used_categories
     # TODO - insert here most commented articles, sorted by number of comments
-    @most_commented_articles = Article.recent_articles
+    @most_commented_articles = Article.recent_articles(params[:page])
     # load the most used tags
     @tagz         = Tag.most_used_tags
     </diff>
      <filename>app/controllers/home_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -44,7 +44,17 @@ private
            # finally read the body
            body = (entry/:content).blank? ? entry/:description : entry/:content
            article.body        = cleanup_feed(body.inner_html)
-           article.save
+           
+           # check first if this article was already imported. we'll make the supposition
+           # that the title has not changed since the last import. otherwise we cannot avoid
+           # reimporting the same articles over and over again
+           existing_article = Article.find(:first, :conditions =&gt; [&quot;title = ?&quot;, article.title])
+
+           unless existing_article.nil?
+             existing_article.update_attributes(article)
+           else
+             article.save
+           end
        end
   end
   </diff>
      <filename>app/controllers/import_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,6 +8,10 @@ class Article &lt; ActiveRecord::Base
   validates_presence_of :title, :message =&gt; _('specify_title')
   validates_presence_of :body, :message =&gt; _('specify_body')
   
+  # this attribute is used by the pagination functionality found in will_paginate gem
+  cattr_reader :per_page
+  @@per_page = 5
+  
   # we do this for pretty url
   def to_param
     &quot;#{id}-#{title.gsub(/\W+/, ' ').strip.downcase.gsub(/\ +/, '-')}&quot;
@@ -23,24 +27,24 @@ class Article &lt; ActiveRecord::Base
   end
   
   # specific finders
-  def self.filtered_articles(criteria='', count = 10)
-    find(:all, :conditions =&gt; [&quot;title or body LIKE ?&quot;, &quot;%#{criteria}%&quot;])
+  def self.filtered_articles(page, criteria='')
+    paginate(:page =&gt; page, :conditions =&gt; [&quot;title or body LIKE ?&quot;, &quot;%#{criteria}%&quot;])
   end
   
-  def self.recent_articles(category = '', count = 10)
+  def self.recent_articles(page, category = '')
     if category.blank?
-      return find(:all, :limit =&gt; count, :order =&gt; 'articles.created_at DESC', :include =&gt; [:tags, :user])
+      return paginate(:page =&gt; page, :order =&gt; 'articles.created_at DESC', :include =&gt; [:tags, :user])
     else
-      return find(:all, :conditions =&gt;[&quot;category_id = ?&quot;, category], :limit =&gt; count, :order =&gt; 'articles.created_at DESC', :include =&gt; [:tags, :user])
+      return paginate(:page =&gt; page, :conditions =&gt;[&quot;category_id = ?&quot;, category], :order =&gt; 'articles.created_at DESC', :include =&gt; [:tags, :user])
     end
   end
   
-  def self.find_by_tag_and_author(tag, author)
+  def self.find_by_tag_and_author(tag, author, page)
     tag = Tag.find_by_id(tag)
     unless tag.blank?
-      tag.articles.find(:all, :conditions =&gt; [&quot;user_id = ?&quot;, author.id], :order =&gt; &quot;created_at DESC&quot;)
+      tag.articles.paginate(:page =&gt; page, :conditions =&gt; [&quot;user_id = ?&quot;, author.id], :order =&gt; &quot;created_at DESC&quot;)
     else
-      find(:all, :conditions =&gt; [&quot;user_id = ?&quot;, author.id], :order =&gt; &quot;created_at DESC&quot;)
+      paginate(:page =&gt; page, :conditions =&gt; [&quot;user_id = ?&quot;, author.id], :order =&gt; &quot;created_at DESC&quot;)
     end
   end
   </diff>
      <filename>app/models/article.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,5 +22,7 @@
   &lt;/p&gt;
 
   &lt;% end -%&gt;
+
+  &lt;%= will_paginate @articles %&gt;
   
 &lt;% end -%&gt;
\ No newline at end of file</diff>
      <filename>app/views/blogs/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -4,5 +4,6 @@
   &lt;p&gt;
     &lt;%= @invitations_article.title %&gt; &lt;span class=&quot;read_all_link&quot;&gt;
     &lt;%= link_to read_entire_article(@invitations_article),  blog_article_url(@invitations_article.user, @invitations_article) %&gt;&lt;/span&gt;
+    &lt;%= will_paginate @articles %&gt;
   &lt;/p&gt; 
 &lt;% end -%&gt;
\ No newline at end of file</diff>
      <filename>app/views/layouts/_homepage_header.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -56,3 +56,7 @@ Rails::Initializer.run do |config|
   # -- all .rb files in that directory are automatically loaded
   
 end
+
+require 'will_paginate'
+WillPaginate::ViewHelpers.pagination_options[:prev_label] = '&amp;laquo; Inapoi'
+WillPaginate::ViewHelpers.pagination_options[:next_label] = 'Inainte &amp;raquo;'
\ No newline at end of file</diff>
      <filename>config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -409,7 +409,7 @@ a.leave_email_and_url span{
 	text-decoration: underline;
 }
 
-.read_all_link a, .article_author a, .article_comment a, .comment_author a{
+.read_all_link a, .article_author a, .article_comment a, .comment_author a, div.pagination a{
 	font-size: 14px;
 	color: #00809A;
 	text-decoration: underline;</diff>
      <filename>public/stylesheets/blogpub.css</filename>
    </modified>
    <modified>
      <diff>@@ -103,5 +103,4 @@ choose_theme: alege tema pentru blog
 notify_by_mail_for_comments: anunta-ma pe mail cand cineva posteaza un comentariu la articolele mele
 profile_updated: profilul a fost modificat
 error_updating_profile: profilul nu a putut fi modificat. te rog asigura-te ca ai ales o poza uploadata in sistem
-
  
\ No newline at end of file</diff>
      <filename>vendor/plugins/polyglot/languages/ro.yml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ecae645dac5dbde91664cbe8dfb77efab1b521fb</id>
    </parent>
  </parents>
  <author>
    <name>sergiu truta</name>
    <email>sergiutruta@gmail.com</email>
  </author>
  <url>http://github.com/sergiutruta/blogpub/commit/6e97fb9310962ad9a4ac6a37b5d2a0e5b5a5c087</url>
  <id>6e97fb9310962ad9a4ac6a37b5d2a0e5b5a5c087</id>
  <committed-date>2008-05-11T07:40:04-07:00</committed-date>
  <authored-date>2008-05-11T07:40:04-07:00</authored-date>
  <message>added pagination to main blog page and to each individual blogs pages</message>
  <tree>b13ec7963a32d6aca8df63c0e5f7f054de173701</tree>
  <committer>
    <name>sergiu truta</name>
    <email>sergiutruta@gmail.com</email>
  </committer>
</commit>
