<commit_before><?php
/**
 * Created by <NAME> <<EMAIL>>
 * Date: 11/06/11
 */

namespace Flock\MainBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Extra;
use Symfony\Component\HttpFoundation\Request;

/**
 * @Extra\Route("/auth")
 */
class AuthController extends Controller
{
    /**
     * @Extra\Route("/login", name="flock_login")
     * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
     */
    public function indexAction()
    {
        return $this->render('FlockMainBundle:Default:index.html.twig', array());
    }

    /**
     * @Extra\Route("/twitter", name="twitter_auth")
     *
     * @param \Symfony\Component\HttpFoundation\Request $request
     * @return void
     */
    public function twitterAction(Request $request)
    {
         return new RedirectResponse($request->headers->get('referer'));
    }
}
<commit_msg>Fix to redirect to homepage when no referer is defined<commit_after><?php
/**
 * Created by <NAME> <<EMAIL>>
 * Date: 11/06/11
 */

namespace Flock\MainBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Extra;
use Symfony\Component\HttpFoundation\Request;

/**
 * @Extra\Route("/auth")
 */
class AuthController extends Controller
{
    /**
     * @Extra\Route("/login", name="flock_login")
     * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
     */
    public function indexAction()
    {
        return $this->render('FlockMainBundle:Default:index.html.twig', array());
    }

    /**
     * @Extra\Route("/twitter", name="twitter_auth")
     *
     * @param \Symfony\Component\HttpFoundation\Request $request
     * @return void
     */
    public function twitterAction(Request $request)
    {
        $redirectTo = $request->headers->get('referer') ?: '/';
        return new RedirectResponse($redirectTo);
    }
}

{'fraction_non_alphanumeric': 0.14040778498609824, 'fraction_numerical': 0.005560704355885079, 'mean_word_length': 3.683297180043384, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4886341', 'n_tokens_mistral': 630, 'n_tokens_neox': 620, 'n_words': 111}