void purgeLastArticles(int amountToPurge){
  if (!isDBAvailable())   return;
  long time=System.currentTimeMillis();
  String query="_id IN ( SELECT _id FROM " + TABLE_ARTICLES + " WHERE isPublished=0 AND isStarred=0 ORDER BY updateDate DESC LIMIT -1 OFFSET "+ (Utils.ARTICLE_LIMIT - amountToPurge + ")");
  safelyDeleteArticles(query,null);
  Log.d(TAG,"purgeLastArticles took " + (System.currentTimeMillis() - time) + "ms");
}

void purgeLastArticles ( int amountToPurge ) { if ( ! isDBAvailable ( ) ) return ; long time = System . currentTimeMillis ( ) ; String query = "_id IN ( SELECT _id FROM " + TABLE_ARTICLES + " WHERE isPublished=0 AND isStarred=0 ORDER BY updateDate DESC LIMIT -1 OFFSET " + ( Utils . ARTICLE_LIMIT - amountToPurge + ")" ) ; safelyDeleteArticles ( query , null ) ; Log . d ( TAG , "purgeLastArticles took " + ( System . currentTimeMillis ( ) - time ) + "ms" ) ; }
delete given amount of last updated articles from db . published and starred articles are ignored so the configured limit is not an exact upper limit to the number of articles in the database .
