diff --git a/README.txt b/README.txt
index 2b3da3d..f76c27b 100644
--- a/README.txt
+++ b/README.txt
@@ -115,6 +115,9 @@ not supported.
 If a certain property isn't valid an HTTP status code 412 will be returned
 containing an error message.
 
+Meta Controls
+-------------
+
 Additionally to the filters RestWS also supports meta controls, which allow you
 to control your output. Currently only sort and direction are supported.
 This two meta controls allow you to sort your output by a specific property of
@@ -124,9 +127,21 @@ DESC for the meta control direction.
 
 /taxonomy_term.json?sort=tid&direction=DESC
 
+You can limit the results with the meta control limit which is by default 100.
+To navigate through the generated pages, you have to use meta control page.
+
+/node.json?limit=10&page=3
+
+The output always has a self, a first and a last element, which contain a link
+to the current, first and last page. If your current page isn't the last or the
+first one, RestWS will also generate prev and next links. For xml they can be
+found in the tags <link /> in the first hirachy.
+
 If one of your resource properties collides with one of RestWS meta control
 keywords, you have prefix it with property_, when specifying it as filter.
 
+
+
 Debugging
 ---------
 
diff --git a/restws.entity.inc b/restws.entity.inc
index 0c4a3f6..5cdb046 100644
--- a/restws.entity.inc
+++ b/restws.entity.inc
@@ -79,7 +79,8 @@ interface RestWSResourceControllerInterface {
    *   A list of properties to query for, or an empty array if all resources
    *   should be returned.
    * @param array $meta_controls
-   *   @see Meta controls constant.
+   *   Parameters which control the output of the query
+   *   @see restws_meta_controls().
    *
    * @return array
    *   An array containing the ids of the matching resources.
@@ -87,6 +88,30 @@ interface RestWSResourceControllerInterface {
   public function query($filters = array(), $meta_controls = array());
 
   /**
+   * Returns the number of resources available with the given filters.
+   *
+   * @param array $filters
+   *   A list of properties to query for, or an empty array if all resources
+   *   should be returned.
+   *
+   * @return
+   *   The number of resources available.
+   */
+  public function count($filters= array());
+
+  /**
+   * Returns the limit for the current query.
+   *
+   * @param array $meta_controls
+   *   Parameters which control the output of the query
+   *   @see restws_meta_controls().
+   *
+   * @return
+   *   The limit of the current limit.
+   */
+  public function limit(array $meta_controls = array());
+
+  /**
    * Determines access for a given operation and resource.
    *
    * @param string $op
@@ -177,26 +202,36 @@ class RestWSEntityResourceController implements RestWSResourceControllerInterfac
    * Implements RestWSResourceControllerInterface::query().
    */
   public function query($filters = array(), $meta_controls = array()) {
-    $limit = variable_get("restws_query_max_limit", 100);
+    $limit = variable_get('restws_query_max_limit', 100);
+    $start = 0;
 
     $query =  new EntityFieldQuery();
     $query->entityCondition('entity_type', $this->resource());
-    $query->pager($limit);
 
     foreach ($filters as $filter => $value) {
       $this->propertyQueryOperation($query, 'Condition', $filter, $value);
     }
 
     $rest_controls = restws_meta_controls();
-    foreach ($meta_controls as $control_name => $property) {
+    foreach ($meta_controls as $control_name => $value) {
       switch ($control_name) {
         case $rest_controls['sort']:
           $direction = isset($meta_controls[$rest_controls['direction']]) ? $meta_controls[$rest_controls['direction']] : 'ASC';
-          $this->propertyQueryOperation($query, 'OrderBy', $property, $direction);
+          $this->propertyQueryOperation($query, 'OrderBy', $value, $direction);
+          break;
+        case $rest_controls['limit']:
+          $limit = $value < $limit ? $value : $limit;
+          break;
+        case $rest_controls['page']:
+          $start = $value > 0 ? $value : $start;
           break;
       }
     }
 
+    $start *= $limit;
+
+    $query->range($start, $limit);
+
     // Catch any errors, like wrong keywords or properties.
     try {
       $query_result = $query->execute();
@@ -210,6 +245,24 @@ class RestWSEntityResourceController implements RestWSResourceControllerInterfac
     return $result;
   }
 
+  public function count($filters= array()) {
+    $query =  new EntityFieldQuery();
+    $query->entityCondition('entity_type', $this->resource());
+
+    foreach ($filters as $filter => $value) {
+      $this->propertyQueryOperation($query, 'Condition', $filter, $value);
+    }
+    $query->count();
+
+    return $query->execute();
+  }
+
+  public function limit(array $meta_controls = array()) {
+    $rest_controls = restws_meta_controls();
+    $limit = variable_get('restws_query_max_limit', 100);
+    return (isset($meta_controls[$rest_controls['limit']]) ? $meta_controls[$rest_controls['limit']] : $limit);
+  }
+
   public function access($op, $id) {
     return entity_access($op, $this->entityType, isset($id) ? $this->wrapper($id)->value() : NULL);
   }
diff --git a/restws.formats.inc b/restws.formats.inc
index a07af91..ecc0732 100644
--- a/restws.formats.inc
+++ b/restws.formats.inc
@@ -140,6 +140,17 @@ abstract class RestWSBaseFormat implements RestWSFormatInterface {
     $result = $this->query($resourceController);
 
     $values = array();
+
+    $values['self'] = $this->generateQueryURI($resourceController, 'self');
+    $values['first'] = $this->generateQueryURI($resourceController, 'first');
+    $values['last'] = $this->generateQueryURI($resourceController, 'last');
+    if (($prev= $this->generateQueryURI($resourceController, 'prev')) != FALSE) {
+      $values['prev'] = $prev;
+    }
+    if (($next= $this->generateQueryURI($resourceController, 'next')) != FALSE) {
+      $values['next'] = $next;
+    }
+
     foreach ($result as $id) {
       $values['list'][] = self::getData($resourceController->wrapper($id));
     }
@@ -347,6 +358,62 @@ abstract class RestWSBaseFormat implements RestWSFormatInterface {
     }
     return array('meta_controls' => $meta_controls, 'filters' => $filters);
   }
+
+  /**
+   * Generates navigation links for querying.
+   *
+   * @param RestWSResourceControllerInterface $resourceController
+   *   The controller used to query the resource.
+   *
+   * @param $rel
+   *   Either self, prev, next, first or last defining the relationship to the
+   *   current page.
+   *
+   * @return bool|string
+   *   Either a string with the uri or FALSE if not available.
+   *
+   * @throws RestWSException
+   *   If the page is out of range the function will throw a new RestWSException
+   *   with HTTP status code 404.
+   */
+  protected function generateQueryURI($resourceController, $rel) {
+    $parameters = drupal_get_query_parameters();
+    $rest_controls = restws_meta_controls();
+
+    $split_parameters = $this->splitParameters($resourceController->propertyInfo(), $parameters);
+
+    $count = $resourceController->count($split_parameters['filters']);
+    $limit = $resourceController->limit($split_parameters['meta_controls']);
+    $page = isset($parameters[$rest_controls['page']]) ? $parameters[$rest_controls['page']] : 0;
+
+    $last = ceil($count/$limit)-1;
+
+    if ($page > $last || $page < 0) {
+      throw new RestWSException('Page doesn\'t exist.', 404);
+    }
+    switch ($rel) {
+      case 'prev':
+        if ($page == 0) {
+          return FALSE;
+        }
+        $parameters['page'] = $page-1;
+        break;
+      case 'next':
+        if ($page == $last) {
+          return FALSE;
+        }
+        $parameters['page'] = $page+1 ;
+        break;
+      case 'first':
+        $parameters['page'] = 0;
+        break;
+      case 'last':
+        $parameters['page'] = $last;
+        break;
+    }
+
+    return url($resourceController->resource(), array('absolute' => TRUE, 'alias' => TRUE, 'query' => $parameters));
+  }
 }
 
 /**
@@ -422,6 +489,12 @@ class RestWSFormatXML extends RestWSBaseFormat {
     $xml = new DOMDocument('1.0', 'utf-8');
     $element = $xml->createElement('list');
 
+    $this->appendQueryLink($xml, $element, $resourceController, 'self');
+    $this->appendQueryLink($xml, $element, $resourceController, 'first');
+    $this->appendQueryLink($xml, $element, $resourceController, 'last');
+    $this->appendQueryLink($xml, $element, $resourceController, 'prev');
+    $this->appendQueryLink($xml, $element, $resourceController, 'next');
+
     $values = $this->query($resourceController);
     foreach ($values as $id) {
       $item = $xml->createElement($resourceController->resource());
@@ -497,6 +570,32 @@ class RestWSFormatXML extends RestWSBaseFormat {
   }
 
   /**
+   * Adds a query link uri to the given element with given relation ship.
+   *
+   * @param DOMDocument $xml
+   *   The document which creates the elements.
+   *
+   * @param DOMNode $parent
+   *   Parent node on which the uri elements should be append.
+   *
+   * @param RestWSResourceControllerInterface $resourceController
+   *   The controller used to query the resource.
+   *
+   * @param $rel
+   *   The relation ship to the current page @see
+   *   RestWSBaseFormat::generateQueryURI().
+   */
+  protected function appendQueryLink(DOMDocument $xml, DOMNode &$parent, RestWSResourceControllerInterface $resourceController, $rel) {
+    $item = $xml->createElement('link');
+    $item->setAttribute('rel', $rel);
+    if (($content = $this->generateQueryURI($resourceController, $rel)) != FALSE) {
+      $uri = $xml->createTextNode($content);
+      $item->appendChild($uri);
+      $parent->appendChild($item);
+    }
+  }
+
+  /**
    * Adds the data of the given wrapper to the given XML element.
    */
   public static function addToXML(DOMDocument $doc, DOMNode $parent, $wrapper) {
diff --git a/restws.module b/restws.module
index ae0ffc1..d00f582 100644
--- a/restws.module
+++ b/restws.module
@@ -405,5 +405,7 @@ function restws_meta_controls() {
   return array(
     'sort'=>'sort',
     'direction'=>'direction',
+    'page' => 'page',
+    'limit' => 'limit',
   );
 }
diff --git a/restws.test b/restws.test
index dfe69a8..d61a5ca 100644
--- a/restws.test
+++ b/restws.test
@@ -236,7 +236,6 @@ class RestWSTestCase extends DrupalWebTestCase {
     $result = $this->httpRequest('node.json', 'GET', $account, array('sort'=> 'title', 'direction' => 'DESC'));
     $result_nodes = drupal_json_decode($result);
 
-    $this->verbose($result);
     // Start by checking if the last node created is the first in the result.
     $i = 4;
     foreach ($result_nodes['list'] as $key => $node) {
@@ -267,6 +266,27 @@ class RestWSTestCase extends DrupalWebTestCase {
 
     $this->assertEqual($nodes['list'][1]['title'], 'node3', 'Right node title was received.');
     $this->assertEqual($nodes['list'][1]['field_tags'][0]['id'], 1, 'Node has taxonomy term.');
+
+    // Test paging and limiting.
+    $result = $this->httpRequest('node.json', 'GET', $account, array('limit'=> 2, 'page' => 0));
+    $result_nodes = drupal_json_decode($result);
+
+    $this->assertTrue(count($result_nodes['list'] > 2), 'Only two elements where returned');
+
+    $this->assertTrue(isset($result_nodes['self']), 'Self link was generated');
+    $this->assertTrue(isset($result_nodes['first']), 'First link was generated');
+    $this->assertTrue(isset($result_nodes['last']), 'Last link was generated');
+    $this->assertTrue(isset($result_nodes['next']), 'Next link was generated');
+    $this->assertFalse(isset($result_nodes['prev']), 'Prev link was generated');
+
+    $result = $this->httpRequest('node.json', 'GET', $account, array('limit'=> 2, 'page' => 2));
+    $result_nodes = drupal_json_decode($result);
+
+    $this->assertFalse(isset($result_nodes['next']), 'Next link was generated');
+    $this->assertTrue(isset($result_nodes['prev']), 'Prev link was generated');
+
+    $result = $this->httpRequest('node.json', 'GET', $account, array('limit'=> 2, 'page' => 5));
+    $this->assertResponse('404', 'HTTP response code is correct.');
   }
 
   /**
