   data = count: found.count()
 
   # Complete find options with skip and limit
-  opts.skip = @_options.limit * (@_options.page - 1)
-  opts.limit = @_options.limit
+  opts =
+    sort: @_sort
+    fields: @_fields
+    skip: @_options.limit * (@_options.page - 1)
+    limit: @_options.limit
+
   found = @_options.collection.find query, opts
 
   # For reading convenience :)
   data.startIndex = opts.skip + 1
-  data.endIndex = data.startIndex + opts.limit - 1
+  data.endIndex = if data.startIndex + opts.limit > data.count
+    data.count
+  else opts.skip + opts.limit
   data.page = @_options.page
 
   # Math magic under this line!

    result.header =
      columns: labels

  opts =
    sort: @_sort
    fields: @_fields

  query = {}
  if @_query instanceof Array
    query["$or"] = @_query

    maxPages = totalPages - pageBase
    if maxPages > opt_maxPages
      maxPages = opt_maxPages
    {
      page: idx+1+pageBase
      active: idx+1+pageBase is data.page
    } for idx in [0..maxPages-1]
  )(@_options.maxPages)

  data.rows = found.map (row, index) ->
    {
      rowIndex: index + 1    # startIndex + rowIndex <= endIndex
      values: (row[field] ? `undefined` for field in fields)
    }

  if data.rows.length > 0 or showBodyIfNoData
    result.data = data
