public function prepareTable(WebRequest $request, TableAbstract $table, $paginationUrl, $numberOfEntries = 10)
    {
        // If the table has no pagination we do not limit the number of entries 
        // which will be displayed
        if (!$table->hasPagination()) {
            $numberOfEntries = false;
        }
        
        // Generate the data request
        $dataRequest = $this->generateDataRequest($request, $table, $numberOfEntries);
        
        // Get the data
        $data = $table->getData($dataRequest);
        if (!is_array($data)) {
            $data = array();
        }

        $preparedTable = new PreparedTable($table, $table->getColumns());
        $preparedTable->setOptions($table->getOptions());
        
        // Add the table head
        $preparedTable->setHead($this->renderHead($table, $dataRequest));
        
        // Render the body and add it to the rendered table
        $body = new Body();
        foreach ($data as $object) {
            $body->addRow($this->renderRow($table, $body, $object));
        }
        $preparedTable->setBody($body);
        
        // Add the table foot
        $preparedTable->setFoot($this->renderFoot($table));
        
        // Create the token
        $token = uniqid('dt');
        $preparedTable->setToken($token);
        $request->setSessionData('dt-class-' . $token, get_class($table));
        $request->setSessionData('dt-time-' . $token, time());
        $request->setSessionData('dt-options-' . $token, json_encode($table->getOptions()));
        
        return $preparedTable;
    }