## Bug description

When you create a trend with two lines, one of which is say $pageview with a filter of browser = chrome and the other is ALSO $pageview but a different filter.

If you click on any the line you get the same users in the persons modal, even if you switch the trend line toggle in the modal.

## How to reproduce

1. Create a new trend
2. Add a $pageview trendline, and another $pageview trendline with a subfilter
3. Click on any of the lines
4. Open the persons modal and switch between the trend lines in the persons modal

## Environment

- [x] PostHog Cloud
- [ ] self-hosted PostHog (ClickHouse-based), version/commit: _please provide_
- [ ] self-hosted PostHog (Postgres-based, legacy), version/commit: _please provide_

## Additional context



#### *Thank you* for your bug report – we love squashing them!

posthog/api/utils.py
entity_id: str, entity_type: Optional[str], entity_math: MATH_TYPE, events: List[Entity], actions: List[Entity]
) -> Optional[Entity]:
    """
    Retrieves the entity from the events and actions.
    NOTE: entity_id here is considered always to be a string. event ids are
    strings, and action ids are ints. Elsewhere we get the `entity_id` from a
    get request, from which we do not get type information, and we do not
    require the entity type to be provided. A more complete solution might be to
    require entity type information, but to resolve the issue we cast the action
    id to a string, such that we can get equality.
    This doesn't preclude ths issue that an event name could be a string that is
    also a valid number however, but this should be an unlikely occurance.
    """
    if entity_type == "actions":
        for action in actions:
            if action.id == entity_id and (action.math or "total") == entity_math:
                return action
    else:
        for event in events:
            if event.id == entity_id and (event.math or "total") == entity_math:
                return event
    return None
def format_paginated_url(request: request.Request, offset: int, page_size: int, mode=PaginationMode.next):