code: @Override
      public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
          if (params.size() > 1)
          {
              String message = "This directive doesn't allow multiple parameters.";
              errors.add(message);
              throw new TemplateModelException(message);
          }
          if (params.size() == 1 && !((Map.Entry)params.entrySet().toArray()[0]).getKey().equals("sql")) {
              String message = "This directive only takes 'sql', which you specify the type of engine, ie mysql, postgres, etc.";
              errors.add(message);
              throw new TemplateModelException(message);
          }
          Object sqlParam = params.get("sql");
          String engine = "mysql";
          if (sqlParam == null) { } else
          if (sqlParam instanceof TemplateScalarModel)
          {
              TemplateScalarModel engineParam = (TemplateScalarModel) sqlParam;
              engine = engineParam.getAsString();
          } else {
              String message = "This directive only accepts string values for 'sql'.";
              errors.add(message);
              throw new TemplateModelException(message);
          }
          if (loopVars.length != 0) throw new TemplateModelException("This directive doesn't allow loop variables.");
          limitExists[0] = true;
          int limit = freemarkerSQLDataReportConnector.getPageLimit();
          int offset = freemarkerSQLDataReportConnector.getPage() * limit;
          if (engine.equalsIgnoreCase("mysql") || engine.equalsIgnoreCase("postgres"))
          {
              env.getOut().write(" LIMIT " + limit + " OFFSET " + offset + " ");
          } else
          {
              String message = "Unknown SQL Engine " + engine + ".";
              errors.add(message);
              throw new TemplateModelException(message);
          }
      }
docs: Inserts the appropriate LIMIT .. OFFSET .. statement into the query.
  {@inheritDoc}